From: Nadia Chambers <nadia.yvette.chambers@ik.me>
To: Dave Hansen <dave.hansen@intel.com>
Cc: Kiryl Shutsemau <kas@kernel.org>,
lsf-pc@lists.linux-foundation.org, linux-mm@kvack.org,
x86@kernel.org, linux-kernel@vger.kernel.org,
Andrew Morton <akpm@linux-foundation.org>,
David Hildenbrand <david@kernel.org>,
Thomas Gleixner <tglx@linutronix.de>,
Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>,
Dave Hansen <dave.hansen@linux.intel.com>,
Lorenzo Stoakes <lorenzo.stoakes@oracle.com>,
"Liam R. Howlett" <Liam.Howlett@oracle.com>,
Mike Rapoport <rppt@kernel.org>,
Matthew Wilcox <willy@infradead.org>,
Johannes Weiner <hannes@cmpxchg.org>,
Usama Arif <usama.arif@linux.dev>
Subject: Re: [LSF/MM/BPF TOPIC] 64k (or 16k) base page size on x86
Date: Sun, 19 Jul 2026 05:42:39 +0200 [thread overview]
Message-ID: <alw7RLxxmeT-moTk@ik.me> (raw)
In-Reply-To: <46817fe5-7166-4734-bad3-3109cc7feb1e@intel.com>
On Thu, Feb 19, 2026 at 09:08:57AM -0800, Dave Hansen wrote:
> First of all, this looks like fun. Nice work! I'm not opposed at all in
> concept to cleaning up things and doing the logical separation you
> described to split buddy granularity and mapping granularity. That seems
> like a worthy endeavor and some of the union/#define tricks look like a
> likely viable way to do it incrementally.
My 2003 pgcl code was the funnest kernel hacking I've ever done. You
were there (or at least involved; I don't remember in enough detail to
even be sure if we were together in person) when it got the first public
boot on 32-bit x86 with 64 GiB RAM, and even noted that my earlier work
on shrinking the size of struct page had got things booting with
ridiculously little lowmem left over after mem_map when you were
flagging me down for 16 nodes being available to be glued together.
On Thu, Feb 19, 2026 at 09:08:57AM -0800, Dave Hansen wrote:
> But I don't think there's going to be a lot of memory savings in the
> end. Maybe this would bring the mem= hyperscalers back into the fold and
> have them actually start using 'struct page' again for their VM memory.
> Dunno.
For 32-bit it was only really an issue because it was lowmem. From day
one back in 2003 it was always a matter of trading off internal for
external fragmentation, and there was even some worry about losses from
internal fragmentation potentially exhausting lowmem under load. It's in
a way like being able to adjust the frontier between internal and
external fragmentation more than really saving memory at all. Apart from
lowmem exhaustion on 32-bit and maybe being so large and heavily used
that it competes with userspace for cache and TLB, the struct page
array's memory consumption is mostly irrelevant.
strictly speaking, struct page as presently conceived isn't necessary at
all. There are mostly microkernels out there that do no per-page memory
bookkeeping. The basic pattern is that the commitment to what kind of
bookkeeping to do is mostly deferred until it gets allocated and put in
use, at which point things like slab memory, pagecache memory,
pagetables and such all have different ways of tracking everything. The
basic allocators can do a variety of things, too. In-band metadata IOW
using the memory the allocator is saying is technically free to hold
metadata is one of the tricks, adaptively switching between radix tree
or bitmapped things, using address calculation to only need things like
a pair of bits for each radix tree node's entries, and maybe even bit
twiddling lockfree code etc. all start getting in the mix like LLFree:
https://www.usenix.org/conference/atc23/presentation/wrenger
https://www.sra.uni-hannover.de/Publications/2023/llfree-atc23/
https://github.com/luhsra/llfree-c
You still get a couple of bits per page, but the delayed metadata
allocation getting less internal fragmentation(!) from forcing too many
disparate metadata types into a union isn't saving anywhere near as much
as the disappearance of the centralised, readily-identifiable struct
page array might suggest, so there's more than enough left over to
swamp those bits. Having slab, pagecache, pagetable etc. metadata all
unmixed with each other still means they have significant metadata
footprints that are significant fractions of what a struct page array
would be. The real advantage for memory hyperscalars is that splitting
them those ways enables more locality of reference.
On Thu, Feb 19, 2026 at 09:08:57AM -0800, Dave Hansen wrote:
> But, let's look at my kernel directory and round the file sizes up to
> 4k, 16k and 64k:
> find . -printf '%s\n' | while read size; do echo \
> $(((size + 0x0fff) & 0xfffff000)) \
> $(((size + 0x3fff) & 0xffffc000)) \
> $(((size + 0xffff) & 0xffff0000));
> done
> ... and add them all up:
> 11,297,648 KB - on disk
> 11,297,712 KB - in a 4k page cache
> 12,223,488 KB - in a 16k page cache
> 16,623,296 KB - in a 64k page cache
4 KiB being so close to disc is surprising esp. since disc is usually
doing tail packing atop 512 B blocks. The rest is unsurprising.
On Thu, Feb 19, 2026 at 09:08:57AM -0800, Dave Hansen wrote:
> So a 64k page cache eats ~5GB of extra memory for a kernel tree (well,
> _my_ kernel tree). In other words, if you are looking for memory savings
> on my laptop, you'll need ~300GB of RAM before 'struct page' overhead
> overwhelms the page cache bloat from a single kernel tree.
> The whole kernel obviously isn't in the page cache all at the same time.
> The page cache across the system is also obviously different than a
> kernel tree, but you get the point.
> That's not to diminish how useful something like this might be,
> especially for folks that are sensitive to 'struct page' overhead or
> allocator performance.
> But, it will mostly be getting better performance at the _cost_ of
> consuming more RAM, not saving RAM.
Given that you don't remember the project at all, I can assume the
IBM-internal whitepaper where I described doing tail packing for small
files in the pagecache as part of an array of strategies to mitigate
internal fragmentation and latency issues expected to arise for large
values of PAGE_MMUSHIFT is also forgotten. I wrote some things I thought
worthwhile there and I was hoping you'd be able to at least corroborate
the one-time, now-former existence of the thing and maybe some
smatterings of its contents since it's no longer extant.
Or please do let me know if I've jogged your memory or whatever.
-- nyc
next prev parent reply other threads:[~2026-07-19 3:42 UTC|newest]
Thread overview: 53+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-19 15:08 Kiryl Shutsemau
2026-02-19 15:17 ` Peter Zijlstra
2026-02-19 15:20 ` Peter Zijlstra
2026-02-19 15:27 ` Kiryl Shutsemau
2026-02-19 15:33 ` Pedro Falcato
2026-02-19 15:50 ` Kiryl Shutsemau
2026-02-19 15:53 ` David Hildenbrand (Arm)
2026-02-19 19:31 ` Pedro Falcato
2026-02-19 15:39 ` David Hildenbrand (Arm)
2026-02-19 15:54 ` Kiryl Shutsemau
2026-02-19 16:09 ` David Hildenbrand (Arm)
2026-02-20 2:55 ` Zi Yan
2026-02-19 17:09 ` Kiryl Shutsemau
2026-02-20 10:24 ` David Hildenbrand (Arm)
2026-02-20 12:07 ` Kiryl Shutsemau
2026-02-20 16:30 ` David Hildenbrand (Arm)
2026-02-20 19:33 ` Kalesh Singh
2026-02-23 11:04 ` David Hildenbrand (Arm)
2026-02-23 11:13 ` Kiryl Shutsemau
2026-02-23 11:27 ` David Hildenbrand (Arm)
2026-02-23 12:16 ` Kiryl Shutsemau
2026-02-23 15:14 ` Dave Hansen
2026-02-23 15:31 ` David Hildenbrand (Arm)
2026-02-23 15:45 ` Kiryl Shutsemau
2026-02-23 15:49 ` David Hildenbrand (Arm)
2026-02-23 16:22 ` Lorenzo Stoakes
2026-02-23 16:34 ` David Laight
2026-02-19 23:24 ` Kalesh Singh
2026-02-20 12:10 ` Kiryl Shutsemau
2026-02-20 19:21 ` Kalesh Singh
2026-02-19 17:08 ` Dave Hansen
2026-02-19 22:05 ` Kiryl Shutsemau
2026-02-20 3:28 ` Liam R. Howlett
2026-02-20 12:33 ` Kiryl Shutsemau
2026-02-20 15:17 ` Liam R. Howlett
2026-02-20 15:50 ` Kiryl Shutsemau
2026-07-19 3:42 ` Nadia Chambers [this message]
2026-07-19 5:23 ` Hillf Danton
2026-02-19 17:30 ` Dave Hansen
2026-02-19 22:14 ` Kiryl Shutsemau
2026-02-19 22:21 ` Dave Hansen
2026-02-19 17:47 ` Matthew Wilcox
2026-02-19 22:26 ` Kiryl Shutsemau
2026-02-20 9:04 ` David Laight
2026-02-20 12:12 ` Kiryl Shutsemau
2026-04-29 14:39 ` Matthew Wilcox
2026-04-29 15:26 ` Kiryl Shutsemau
2026-05-01 18:05 ` David Hildenbrand (Arm)
2026-05-01 18:00 ` Kiryl Shutsemau
2026-05-01 18:02 ` David Hildenbrand (Arm)
2026-05-01 18:12 ` Kiryl Shutsemau
2026-05-01 18:31 ` David Hildenbrand (Arm)
2026-07-19 0:51 ` Nadia Chambers
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=alw7RLxxmeT-moTk@ik.me \
--to=nadia.yvette.chambers@ik.me \
--cc=Liam.Howlett@oracle.com \
--cc=akpm@linux-foundation.org \
--cc=bp@alien8.de \
--cc=dave.hansen@intel.com \
--cc=dave.hansen@linux.intel.com \
--cc=david@kernel.org \
--cc=hannes@cmpxchg.org \
--cc=kas@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=lorenzo.stoakes@oracle.com \
--cc=lsf-pc@lists.linux-foundation.org \
--cc=mingo@redhat.com \
--cc=rppt@kernel.org \
--cc=tglx@linutronix.de \
--cc=usama.arif@linux.dev \
--cc=willy@infradead.org \
--cc=x86@kernel.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
Powered by JetHome