[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20150608174551.GA27558@gmail.com>
Date: Mon, 8 Jun 2015 19:45:51 +0200
From: Ingo Molnar <mingo@...nel.org>
To: Mel Gorman <mgorman@...e.de>
Cc: Andrew Morton <akpm@...ux-foundation.org>,
Rik van Riel <riel@...hat.com>,
Hugh Dickins <hughd@...gle.com>,
Minchan Kim <minchan@...nel.org>,
Dave Hansen <dave.hansen@...el.com>,
Andi Kleen <andi@...stfloor.org>,
H Peter Anvin <hpa@...or.com>, Linux-MM <linux-mm@...ck.org>,
LKML <linux-kernel@...r.kernel.org>,
Linus Torvalds <torvalds@...ux-foundation.org>,
Peter Zijlstra <a.p.zijlstra@...llo.nl>,
Thomas Gleixner <tglx@...utronix.de>
Subject: Re: [PATCH 0/3] TLB flush multiple pages per IPI v5
* Mel Gorman <mgorman@...e.de> wrote:
> Changelog since V4
> o Rebase to 4.1-rc6
>
> Changelog since V3
> o Drop batching of TLB flush from migration
> o Redo how larger batching is managed
> o Batch TLB flushes when writable entries exist
>
> When unmapping pages it is necessary to flush the TLB. If that page was
> accessed by another CPU then an IPI is used to flush the remote CPU. That
> is a lot of IPIs if kswapd is scanning and unmapping >100K pages per second.
>
> There already is a window between when a page is unmapped and when it is
> TLB flushed. This series simply increases the window so multiple pages
> can be flushed using a single IPI. This *should* be safe or the kernel is
> hosed already but I've cc'd the x86 maintainers and some of the Intel folk
> for comment.
>
> Patch 1 simply made the rest of the series easier to write as ftrace
> could identify all the senders of TLB flush IPIS.
>
> Patch 2 collects a list of PFNs and sends one IPI to flush them all
>
> Patch 3 tracks when there potentially are writable TLB entries that
> need to be batched differently
>
> The performance impact is documented in the changelogs but in the optimistic
> case on a 4-socket machine the full series reduces interrupts from 900K
> interrupts/second to 60K interrupts/second.
Yeah, so I think batching writable flushes is useful I think, but I disagree with
one aspect of it: with the need to gather _pfns_ and batch them over to the remote
CPU.
As per my measurements the __flush_tlb_single() primitive (which you use in patch
#2) is very expensive on most Intel and AMD CPUs. It barely makes sense for a 2
pages and gets exponentially worse. It's probably done in microcode and its
performance is horrible.
So have you explored the possibility to significantly simplify your patch-set by
only deferring the flushing, and doing a simple TLB flush on the remote CPU? As
per your measurements there must be tons and tons of flushes of lots of pages, the
pfn tracking simply does not make sense.
That way there's no memory overhead and no complex tracking of pfns - we'd
basically track a simple deferred-flush bit instead. We'd still have the benefits
of batching the IPIs, which is the main win.
I strongly suspect that your numbers will become even better with such a variant.
Thanks,
Ingo
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists