Re: [PATCH 2/2] mm/pageblock: remove false sharing in pageblock_flags

From: Matthew Wilcox
Date: Sun Aug 16 2020 - 00:17:30 EST


On Sun, Aug 16, 2020 at 11:47:57AM +0800, Alex Shi wrote:
> Current pageblock_flags is only 4 bits, so it has to share a char size
> in cmpxchg when get set, the false sharing cause perf drop.
>
> If we incrase the bits up to 8, false sharing would gone in cmpxchg. and
> the only cost is half char per pageblock, which is half char per 128MB
> on x86, 4 chars in 1 GB.

I don't believe this patch has that effect, mostly because it still does
cmpxchg() on words instead of bytes.

But which functions would benefit? It seems to me this cmpxchg() is
only called from the set_pageblock_migratetype() morass of functions,
none of which are called in hot paths as far as I can make out.

So are you just reasoning by analogy with the previous patch where you
have measured a performance improvement, or did you send the wrong patch,
or did I overlook a hot path that calls one of the pageblock migration
functions?