linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Byungchul Park <byungchul@sk.com>
To: linux-kernel@vger.kernel.org, linux-mm@kvack.org
Cc: kernel_team@skhynix.com, akpm@linux-foundation.org,
	ying.huang@intel.com, namit@vmware.com, xhao@linux.alibaba.com,
	mgorman@techsingularity.net, hughd@google.com,
	willy@infradead.org, david@redhat.com
Subject: [RFC 0/2] Reduce TLB flushes under some specific conditions
Date: Fri,  4 Aug 2023 15:18:48 +0900	[thread overview]
Message-ID: <20230804061850.21498-1-byungchul@sk.com> (raw)

Hi,

While I'm working with CXL, I have been facing migraion overhead esp.
TLB shootdown on promotion or demotion between different tiers. Yeah..
most TLB shootdowns on migration through hinting fault can be avoided
thanks to Huang Ying's work, commit 4d4b6d66db ("mm,unmap: avoid
flushing TLB in batch if PTE is inaccessible").

However, it's only for ones using hinting fault. I thought it'd be much
better if we have a general mechanism to reduce # of TLB flushes that
we can apply to any type of migration. I tried it only for tiering
migration for now tho.

I'm suggesting a mechanism to reduce TLB flushes by keeping source and
destination of folios participated in the migrations until all TLB
flushes required are done, only if those folios are not mapped with
write permission PTE entries at all.

I saw the number of TLB full flush reduced over 50% and the performance
a little bit improved but not that big with the workload I tested with,
XSBench. However, I believe that it would help more with other ones or
any real ones. It'd be appreciated to tell me if I'm missing something.

	Byungchul

Byungchul Park (2):
  mm/rmap: Recognize non-writable TLB entries during TLB batch flush
  mm: Defer TLB flush by keeping both src and dst folios at migration

 arch/x86/include/asm/tlbflush.h |   9 +
 arch/x86/mm/tlb.c               |  59 +++++++
 include/linux/mm.h              |  30 ++++
 include/linux/mm_types.h        |  34 ++++
 include/linux/mm_types_task.h   |   4 +-
 include/linux/mmzone.h          |   6 +
 include/linux/sched.h           |   5 +
 init/Kconfig                    |  12 ++
 mm/internal.h                   |  14 ++
 mm/memory.c                     |   9 +-
 mm/migrate.c                    | 287 +++++++++++++++++++++++++++++++-
 mm/mm_init.c                    |   1 +
 mm/page_alloc.c                 |  16 ++
 mm/rmap.c                       | 121 +++++++++++++-
 14 files changed, 595 insertions(+), 12 deletions(-)

-- 
2.17.1


             reply	other threads:[~2023-08-04  6:21 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-04  6:18 Byungchul Park [this message]
2023-08-04  6:18 ` [RFC 1/2] mm/rmap: Recognize non-writable TLB entries during TLB batch flush Byungchul Park
2023-08-04  6:18 ` [RFC 2/2] mm: Defer TLB flush by keeping both src and dst folios at migration Byungchul Park
2023-08-04 16:08   ` Zi Yan
2023-08-07  0:43     ` Byungchul Park
2023-08-04 17:32   ` Nadav Amit
2023-08-07  1:42     ` Byungchul Park
2023-08-07  5:05     ` Byungchul Park
2023-08-15  1:27   ` Huang, Ying
2023-08-16  0:13     ` Byungchul Park
2023-08-16  1:01       ` Huang, Ying
2023-08-16  2:40         ` Byungchul Park
2023-08-21  1:28         ` Byungchul Park
2023-08-21  2:51           ` Huang, Ying
2023-08-17  8:16     ` Byungchul Park

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230804061850.21498-1-byungchul@sk.com \
    --to=byungchul@sk.com \
    --cc=akpm@linux-foundation.org \
    --cc=david@redhat.com \
    --cc=hughd@google.com \
    --cc=kernel_team@skhynix.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mgorman@techsingularity.net \
    --cc=namit@vmware.com \
    --cc=willy@infradead.org \
    --cc=xhao@linux.alibaba.com \
    --cc=ying.huang@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).