[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <YGXuCMfBWL51TVu3@cmpxchg.org>
Date: Thu, 1 Apr 2021 12:00:08 -0400
From: Johannes Weiner <hannes@...xchg.org>
To: Al Viro <viro@...iv.linux.org.uk>
Cc: Matthew Wilcox <willy@...radead.org>, linux-mm@...ck.org,
linux-kernel@...r.kernel.org, linux-fsdevel@...r.kernel.org,
linux-cachefs@...hat.com, linux-afs@...ts.infradead.org
Subject: Re: [PATCH v5 00/27] Memory Folios
On Thu, Apr 01, 2021 at 05:05:37AM +0000, Al Viro wrote:
> On Tue, Mar 30, 2021 at 10:09:29PM +0100, Matthew Wilcox wrote:
>
> > That's a very Intel-centric way of looking at it. Other architectures
> > support a multitude of page sizes, from the insane ia64 (4k, 8k, 16k, then
> > every power of four up to 4GB) to more reasonable options like (4k, 32k,
> > 256k, 2M, 16M, 128M). But we (in software) shouldn't constrain ourselves
> > to thinking in terms of what the hardware currently supports. Google
> > have data showing that for their workloads, 32kB is the goldilocks size.
> > I'm sure for some workloads, it's much higher and for others it's lower.
> > But for almost no workload is 4kB the right choice any more, and probably
> > hasn't been since the late 90s.
>
> Out of curiosity I looked at the distribution of file sizes in the
> kernel tree:
> 71455 files total
> 0--4Kb 36702
> 4--8Kb 11820
> 8--16Kb 10066
> 16--32Kb 6984
> 32--64Kb 3804
> 64--128Kb 1498
> 128--256Kb 393
> 256--512Kb 108
> 512Kb--1Mb 35
> 1--2Mb 25
> 2--4Mb 5
> 4--6Mb 7
> 6--8Mb 4
> 12Mb 2
> 14Mb 1
> 16Mb 1
>
> ... incidentally, everything bigger than 1.2Mb lives^Wshambles under
> drivers/gpu/drm/amd/include/asic_reg/
>
> Page size Footprint
> 4Kb 1128Mb
> 8Kb 1324Mb
> 16Kb 1764Mb
> 32Kb 2739Mb
> 64Kb 4832Mb
> 128Kb 9191Mb
> 256Kb 18062Mb
> 512Kb 35883Mb
> 1Mb 71570Mb
> 2Mb 142958Mb
>
> So for kernel builds (as well as grep over the tree, etc.) uniform 2Mb pages
> would be... interesting.
Right, I don't see us getting rid of 4k cache entries anytime
soon. Even 32k pages would double the footprint here.
The issue is just that at the other end of the spectrum we have IO
devices that do 10GB/s, which corresponds to 2.6 million pages per
second. At such data rates we are currently CPU-limited because of the
pure transaction overhead in page reclaim. Workloads like this tend to
use much larger files, and would benefit from a larger paging unit.
Likewise, most production workloads in cloud servers have enormous
anonymous regions and large executables that greatly benefit from
fewer page table levels and bigger TLB entries.
Today, fragmentation prevents the page allocator from producing 2MB
blocks at a satisfactory rate and allocation latency. It's not
feasible to allocate 2M inside page faults for example; getting huge
page coverage for the page cache will be even more difficult.
I'm not saying we should get rid of 4k cache entries. Rather, I'm
wondering out loud whether longer-term we'd want to change the default
page size to 2M, and implement the 4k cache entries, which we clearly
continue to need, with a slab style allocator on top. The idea being
that it'll do a better job at grouping cache entries with other cache
entries of a similar lifetime than the untyped page allocator does
naturally, and so make fragmentation a whole lot more manageable.
(I'm using x86 page sizes as examples because they matter to me. But
there is an architecture independent discrepancy between the smallest
cache entries we must continue to support, and larger blocks / huge
pages that we increasingly rely on as first class pages.)
Powered by blists - more mailing lists