From: Rik van Riel <riel@redhat.com>
To: Ingo Molnar <mingo@kernel.org>
Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org,
shli@kernel.org, akpm@linux-foundation.org, hughd@google.com,
mgorman@suse.de, Linus Torvalds <torvalds@linux-foundation.org>,
Peter Zijlstra <a.p.zijlstra@chello.nl>,
Thomas Gleixner <tglx@linutronix.de>,
"H. Peter Anvin" <hpa@zytor.com>
Subject: Re: [PATCH] x86,mm: delay TLB flush after clearing accessed bit
Date: Tue, 01 Apr 2014 09:26:09 -0400 [thread overview]
Message-ID: <533ABE71.9090507@redhat.com> (raw)
In-Reply-To: <20140401132037.GB7024@gmail.com>
On 04/01/2014 09:20 AM, Ingo Molnar wrote:
>
> * Rik van Riel <riel@redhat.com> wrote:
>
>>>> int ptep_clear_flush_young(struct vm_area_struct *vma,
>>>> unsigned long address, pte_t *ptep)
>>>> {
>>>> - int young;
>>>> + int young, cpu;
>>>>
>>>> young = ptep_test_and_clear_young(vma, address, ptep);
>>>> - if (young)
>>>> - flush_tlb_page(vma, address);
>>>> + if (young) {
>>>> + for_each_cpu(cpu, vma->vm_mm->cpu_vm_mask_var)
>>>> + tlb_set_force_flush(cpu);
>>>
>>> Hm, just to play the devil's advocate - what happens when we have
>>> a va that is used on a few dozen, a few hundred or a few thousand
>>> CPUs? Will the savings be dwarved by the O(nr_cpus_used) loop
>>> overhead?
>>>
>>> Especially as this is touching cachelines on other CPUs and likely
>>> creating the worst kind of cachemisses. That can really kill
>>> performance.
>>
>> flush_tlb_page does the same O(nr_cpus_used) loop, but it sends an
>> IPI to each CPU every time, instead of dirtying a cache line once
>> per pageout run (or until the next context switch).
>>
>> Does that address your concern?
>
> That depends on the platform - which could implement flush_tlb_page()
> as a broadcast IPI - but yes, it was bad before as well, now it became
> more visible and I noticed it :)
>
> Wouldn't it be more scalable to use a generation count as a timestamp,
> and set that in the mm? mm that last flushed before that timestamp
> need to flush, or so. That gets rid of the mask logic and the loop,
> AFAICS.
More scalable in the page eviction code, sure.
However, that would cause the context switch code to load an
additional cache line, so I am not convinced that is a good
tradeoff...
--
All rights reversed
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
next prev parent reply other threads:[~2014-04-01 13:26 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-03-31 15:34 [PATCH] x86,mm: delay TLB flush after clearing accessed bit Rik van Riel
2014-04-01 10:53 ` Ingo Molnar
2014-04-01 12:55 ` Rik van Riel
2014-04-01 13:20 ` Ingo Molnar
2014-04-01 13:26 ` Rik van Riel [this message]
2014-04-01 15:13 ` Linus Torvalds
2014-04-01 16:11 ` Rik van Riel
2014-04-01 16:21 ` Linus Torvalds
2014-04-01 18:31 ` Rik van Riel
2014-04-02 6:06 ` Shaohua Li
2014-04-02 7:46 ` Ingo Molnar
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=533ABE71.9090507@redhat.com \
--to=riel@redhat.com \
--cc=a.p.zijlstra@chello.nl \
--cc=akpm@linux-foundation.org \
--cc=hpa@zytor.com \
--cc=hughd@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mgorman@suse.de \
--cc=mingo@kernel.org \
--cc=shli@kernel.org \
--cc=tglx@linutronix.de \
--cc=torvalds@linux-foundation.org \
/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).