From: Ingo Molnar <mingo@kernel.org>
To: Dave Hansen <dave.hansen@intel.com>
Cc: Mel Gorman <mgorman@suse.de>,
Andrew Morton <akpm@linux-foundation.org>,
Rik van Riel <riel@redhat.com>, Hugh Dickins <hughd@google.com>,
Minchan Kim <minchan@kernel.org>,
Andi Kleen <andi@firstfloor.org>, H Peter Anvin <hpa@zytor.com>,
Linux-MM <linux-mm@kvack.org>,
LKML <linux-kernel@vger.kernel.org>,
Linus Torvalds <torvalds@linux-foundation.org>,
Peter Zijlstra <a.p.zijlstra@chello.nl>,
Thomas Gleixner <tglx@linutronix.de>
Subject: Re: [PATCH 0/3] TLB flush multiple pages per IPI v5
Date: Mon, 8 Jun 2015 23:50:54 +0200 [thread overview]
Message-ID: <20150608215054.GB30566@gmail.com> (raw)
In-Reply-To: <5576042E.9030001@intel.com>
* Dave Hansen <dave.hansen@intel.com> wrote:
> On 06/08/2015 12:52 PM, Ingo Molnar wrote:
> > A CR3 driven TLB flush takes less time than a single INVLPG (!):
> >
> > [ 0.389028] x86/fpu: Cost of: __flush_tlb() fn : 96 cycles
> > [ 0.405885] x86/fpu: Cost of: __flush_tlb_one() fn : 260 cycles
> > [ 0.414302] x86/fpu: Cost of: __flush_tlb_range() fn : 404 cycles
>
> How was that measured, btw? Are these instructions running in a loop?
Yes - see the x86 benchmarking patch in the big FPU submission for an earlier
version.
> Does __flush_tlb_one() include the tracepoint?
No tracing overhead.
> (From the commit I referenced) This was (probably) using a different method than
> you did, but "FULL" below is __flush_tlb() while "1" is __flush_tlb_one(). The
> "cycles" includes some overhead from the tracing:
>
> > FULL: 2.20% 2.20% avg cycles: 2283 cycles/page: xxxx samples: 23960
> > 1: 56.92% 59.12% avg cycles: 1276 cycles/page: 1276 samples: 620895
>
> So it looks like we've got some discrepancy, either from the test methodology or
> the CPU. All of the code and my methodology are in the commit. Could you share
> yours?
Yes, you can reproduce it by applying this patch from the FPU series:
Subject: [PATCH 207/208] x86/fpu: Add FPU performance measurement subsystem
(you were Cc:-ed to it, so it should be in your inbox.)
I've got a more advanced version meanwhile, will post it in the next couple of
days or so.
> > it's true that a full flush has hidden costs not measured above, because it has
> > knock-on effects (because it drops non-global TLB entries), but it's not _that_
> > bad due to:
> >
> > - there almost always being a L1 or L2 cache miss when a TLB miss occurs,
> > which latency can be overlaid
> >
> > - global bit being held for kernel entries
> >
> > - user-space with high memory pressure trashing through TLBs typically
> >
> > ... and especially with caches and Intel's historically phenomenally low TLB
> > refill latency it's difficult to measure the effects of local TLB refills, let
> > alone measure it in any macro benchmark.
>
> All that you're saying there is that you need to consider how TLB misses act in
> _practice_ and not just measure worst-case or theoretical TLB miss cost. I
> completely agree with that.
So I'm saying considerably more than that: I consider it likely that a full TLB
flush is not nearly as costly as assumed, for the three reasons outlined above.
It might even be a performance win in Mel's benchmark - although possibly not
measurable within measurement noise levels.
Thanks,
Ingo
--
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>
WARNING: multiple messages have this Message-ID (diff)
From: Ingo Molnar <mingo@kernel.org>
To: Dave Hansen <dave.hansen@intel.com>
Cc: Mel Gorman <mgorman@suse.de>,
Andrew Morton <akpm@linux-foundation.org>,
Rik van Riel <riel@redhat.com>, Hugh Dickins <hughd@google.com>,
Minchan Kim <minchan@kernel.org>,
Andi Kleen <andi@firstfloor.org>, H Peter Anvin <hpa@zytor.com>,
Linux-MM <linux-mm@kvack.org>,
LKML <linux-kernel@vger.kernel.org>,
Linus Torvalds <torvalds@linux-foundation.org>,
Peter Zijlstra <a.p.zijlstra@chello.nl>,
Thomas Gleixner <tglx@linutronix.de>
Subject: Re: [PATCH 0/3] TLB flush multiple pages per IPI v5
Date: Mon, 8 Jun 2015 23:50:54 +0200 [thread overview]
Message-ID: <20150608215054.GB30566@gmail.com> (raw)
In-Reply-To: <5576042E.9030001@intel.com>
* Dave Hansen <dave.hansen@intel.com> wrote:
> On 06/08/2015 12:52 PM, Ingo Molnar wrote:
> > A CR3 driven TLB flush takes less time than a single INVLPG (!):
> >
> > [ 0.389028] x86/fpu: Cost of: __flush_tlb() fn : 96 cycles
> > [ 0.405885] x86/fpu: Cost of: __flush_tlb_one() fn : 260 cycles
> > [ 0.414302] x86/fpu: Cost of: __flush_tlb_range() fn : 404 cycles
>
> How was that measured, btw? Are these instructions running in a loop?
Yes - see the x86 benchmarking patch in the big FPU submission for an earlier
version.
> Does __flush_tlb_one() include the tracepoint?
No tracing overhead.
> (From the commit I referenced) This was (probably) using a different method than
> you did, but "FULL" below is __flush_tlb() while "1" is __flush_tlb_one(). The
> "cycles" includes some overhead from the tracing:
>
> > FULL: 2.20% 2.20% avg cycles: 2283 cycles/page: xxxx samples: 23960
> > 1: 56.92% 59.12% avg cycles: 1276 cycles/page: 1276 samples: 620895
>
> So it looks like we've got some discrepancy, either from the test methodology or
> the CPU. All of the code and my methodology are in the commit. Could you share
> yours?
Yes, you can reproduce it by applying this patch from the FPU series:
Subject: [PATCH 207/208] x86/fpu: Add FPU performance measurement subsystem
(you were Cc:-ed to it, so it should be in your inbox.)
I've got a more advanced version meanwhile, will post it in the next couple of
days or so.
> > it's true that a full flush has hidden costs not measured above, because it has
> > knock-on effects (because it drops non-global TLB entries), but it's not _that_
> > bad due to:
> >
> > - there almost always being a L1 or L2 cache miss when a TLB miss occurs,
> > which latency can be overlaid
> >
> > - global bit being held for kernel entries
> >
> > - user-space with high memory pressure trashing through TLBs typically
> >
> > ... and especially with caches and Intel's historically phenomenally low TLB
> > refill latency it's difficult to measure the effects of local TLB refills, let
> > alone measure it in any macro benchmark.
>
> All that you're saying there is that you need to consider how TLB misses act in
> _practice_ and not just measure worst-case or theoretical TLB miss cost. I
> completely agree with that.
So I'm saying considerably more than that: I consider it likely that a full TLB
flush is not nearly as costly as assumed, for the three reasons outlined above.
It might even be a performance win in Mel's benchmark - although possibly not
measurable within measurement noise levels.
Thanks,
Ingo
next prev parent reply other threads:[~2015-06-08 21:51 UTC|newest]
Thread overview: 83+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-06-08 12:50 [PATCH 0/3] TLB flush multiple pages per IPI v5 Mel Gorman
2015-06-08 12:50 ` Mel Gorman
2015-06-08 12:50 ` [PATCH 1/3] x86, mm: Trace when an IPI is about to be sent Mel Gorman
2015-06-08 12:50 ` Mel Gorman
2015-06-08 12:50 ` [PATCH 2/3] mm: Send one IPI per CPU to TLB flush multiple pages that were recently unmapped Mel Gorman
2015-06-08 12:50 ` Mel Gorman
2015-06-08 22:38 ` Andrew Morton
2015-06-08 22:38 ` Andrew Morton
2015-06-09 11:07 ` Mel Gorman
2015-06-09 11:07 ` Mel Gorman
2015-06-08 12:50 ` [PATCH 3/3] mm: Defer flush of writable TLB entries Mel Gorman
2015-06-08 12:50 ` Mel Gorman
2015-06-08 17:45 ` [PATCH 0/3] TLB flush multiple pages per IPI v5 Ingo Molnar
2015-06-08 17:45 ` Ingo Molnar
2015-06-08 18:21 ` Dave Hansen
2015-06-08 18:21 ` Dave Hansen
2015-06-08 19:52 ` Ingo Molnar
2015-06-08 19:52 ` Ingo Molnar
2015-06-08 20:03 ` Ingo Molnar
2015-06-08 20:03 ` Ingo Molnar
2015-06-08 21:07 ` Dave Hansen
2015-06-08 21:07 ` Dave Hansen
2015-06-08 21:50 ` Ingo Molnar [this message]
2015-06-08 21:50 ` Ingo Molnar
2015-06-09 8:47 ` Mel Gorman
2015-06-09 8:47 ` Mel Gorman
2015-06-09 10:32 ` Ingo Molnar
2015-06-09 10:32 ` Ingo Molnar
2015-06-09 11:20 ` Mel Gorman
2015-06-09 11:20 ` Mel Gorman
2015-06-09 12:43 ` Ingo Molnar
2015-06-09 12:43 ` Ingo Molnar
2015-06-09 13:05 ` Mel Gorman
2015-06-09 13:05 ` Mel Gorman
2015-06-10 8:51 ` Ingo Molnar
2015-06-10 8:51 ` Ingo Molnar
2015-06-10 9:08 ` Ingo Molnar
2015-06-10 9:08 ` Ingo Molnar
2015-06-10 10:15 ` Mel Gorman
2015-06-10 10:15 ` Mel Gorman
2015-06-11 15:26 ` Ingo Molnar
2015-06-11 15:26 ` Ingo Molnar
2015-06-10 9:19 ` Mel Gorman
2015-06-10 9:19 ` Mel Gorman
2015-06-09 15:34 ` Dave Hansen
2015-06-09 15:34 ` Dave Hansen
2015-06-09 16:49 ` Dave Hansen
2015-06-09 16:49 ` Dave Hansen
2015-06-09 21:14 ` Dave Hansen
2015-06-09 21:14 ` Dave Hansen
2015-06-09 21:54 ` Linus Torvalds
2015-06-09 21:54 ` Linus Torvalds
2015-06-09 22:32 ` Mel Gorman
2015-06-09 22:32 ` Mel Gorman
2015-06-09 22:35 ` Mel Gorman
2015-06-09 22:35 ` Mel Gorman
2015-06-10 13:13 ` Andi Kleen
2015-06-10 13:13 ` Andi Kleen
2015-06-10 16:17 ` Linus Torvalds
2015-06-10 16:17 ` Linus Torvalds
2015-06-10 16:42 ` Linus Torvalds
2015-06-10 16:42 ` Linus Torvalds
2015-06-10 17:24 ` Mel Gorman
2015-06-10 17:24 ` Mel Gorman
2015-06-10 17:31 ` Linus Torvalds
2015-06-10 17:31 ` Linus Torvalds
2015-06-10 18:08 ` Josh Boyer
2015-06-10 18:08 ` Josh Boyer
2015-06-10 17:07 ` Mel Gorman
2015-06-10 17:07 ` Mel Gorman
2015-06-21 20:22 ` Kirill A. Shutemov
2015-06-21 20:22 ` Kirill A. Shutemov
2015-06-25 11:48 ` Ingo Molnar
2015-06-25 11:48 ` Ingo Molnar
2015-06-25 18:36 ` Linus Torvalds
2015-06-25 19:15 ` Vlastimil Babka
2015-06-25 19:15 ` Vlastimil Babka
2015-06-25 22:04 ` Linus Torvalds
2015-06-25 22:04 ` Linus Torvalds
2015-06-25 18:46 ` Dave Hansen
2015-06-25 18:46 ` Dave Hansen
2015-06-26 9:08 ` Ingo Molnar
2015-06-26 9:08 ` 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=20150608215054.GB30566@gmail.com \
--to=mingo@kernel.org \
--cc=a.p.zijlstra@chello.nl \
--cc=akpm@linux-foundation.org \
--cc=andi@firstfloor.org \
--cc=dave.hansen@intel.com \
--cc=hpa@zytor.com \
--cc=hughd@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mgorman@suse.de \
--cc=minchan@kernel.org \
--cc=riel@redhat.com \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.