linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: Ashish Mhetre <amhetre@nvidia.com>
Cc: vdumpa@nvidia.com, avanbrunt@nvidia.com, Snikam@nvidia.com,
	praithatha@nvidia.com, Shaohua Li <shli@kernel.org>,
	Shaohua Li <shli@fusionio.com>,
	linux-mm@kvack.org, Ingo Molnar <mingo@kernel.org>
Subject: Re: [PATCH] x86/mm: In the PTE swapout page reclaim case clear the accessed bit instead of flushing the TLB
Date: Tue, 9 Oct 2018 09:16:37 +0200	[thread overview]
Message-ID: <20181009071637.GF5663@hirez.programming.kicks-ass.net> (raw)
In-Reply-To: <1539059570-9043-1-git-send-email-amhetre@nvidia.com>

On Tue, Oct 09, 2018 at 10:02:50AM +0530, Ashish Mhetre wrote:
> From: Shaohua Li <shli@kernel.org>
> 
> We use the accessed bit to age a page at page reclaim time,
> and currently we also flush the TLB when doing so.
> 
> But in some workloads TLB flush overhead is very heavy. In my
> simple multithreaded app with a lot of swap to several pcie
> SSDs, removing the tlb flush gives about 20% ~ 30% swapout
> speedup.
> 
> Fortunately just removing the TLB flush is a valid optimization:
> on x86 CPUs, clearing the accessed bit without a TLB flush
> doesn't cause data corruption.
> 
> It could cause incorrect page aging and the (mistaken) reclaim of
> hot pages, but the chance of that should be relatively low.
> 
> So as a performance optimization don't flush the TLB when
> clearing the accessed bit, it will eventually be flushed by
> a context switch or a VM operation anyway. [ In the rare
> event of it not getting flushed for a long time the delay
> shouldn't really matter because there's no real memory
> pressure for swapout to react to. ]

Note that context switches (and here I'm talking about switch_mm(), not
the cheaper switch_to()) do not unconditionally imply a TLB invalidation
these days (on PCID enabled hardware).

So in that regards, the Changelog (and the comment) is a little
misleading.

I don't see anything fundamentally wrong with the patch though; just the
wording.

  reply	other threads:[~2018-10-09  7:16 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-09  4:32 Ashish Mhetre
2018-10-09  7:16 ` Peter Zijlstra [this message]
2018-10-09  7:20   ` Nadav Amit
2018-10-09  7:47     ` Peter Zijlstra
2018-10-09  7:25   ` Ashish Mhetre

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=20181009071637.GF5663@hirez.programming.kicks-ass.net \
    --to=peterz@infradead.org \
    --cc=Snikam@nvidia.com \
    --cc=amhetre@nvidia.com \
    --cc=avanbrunt@nvidia.com \
    --cc=linux-mm@kvack.org \
    --cc=mingo@kernel.org \
    --cc=praithatha@nvidia.com \
    --cc=shli@fusionio.com \
    --cc=shli@kernel.org \
    --cc=vdumpa@nvidia.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