Letting userspace know the page size was IMO a design mistake.
Imagine a world where the page size is secret to userspace. Anything that needs page size alignment will be chosen by the kernel.
That in turn allows mixed page size, variable page size, heirarchical pages, etc.
Dylan16807•2h ago
It's hard to hide all the details, especially when you involve varied permissions over different chunks of memory.
duskwuff•2h ago
It's unavoidable. APIs like mprotect() operate on pages; there's no way to hide that from them.
viraptor•2h ago
Also various performance characteristics graphs will have steps around the multiples of page sizes. People would find out anyway. (Although maybe the runtime detection is not a bad idea)
londons_explore•27m ago
Just like cache size.
But when someone releases a new CPU with a larger or smaller cache, all old software continues to work.
Secret page size would offer the same benefit.
londons_explore•28m ago
you can simulate arbitrary sized mprotect() by having the kernel do the closest it can using the hardware, and then any pages crossing the boundary will be handled by page faults. The performance hit should be small as long as most mprotect regions are large (which they typically are).
londons_explore•24m ago
the mprotect API could have been designed more like malloc() - ie. you don't protect a preexisting memory range - instead the API returns a new memory range with the protections you've asked for, possibly copying a load of data into it for you incase you asked for a readonly range.
And that 'copy' might be zero-overhead remapping of the original pages.
Wowfunhappy•2h ago
So, do 4 KB page size apps work on these 16 KB page size phones? There are plenty of legacy apps (especially games I'd imagine) that will never updated for one reason or another. I would want to know if I was buying a phone that won't support those...
jsheard•2h ago
That ship already sailed, most legacy Android games were killed by 32bit support being phased out both in hardware (newer SOCs are 64bit only) and software (Android 14 doesn't support 32bit apps even when running on an older SOC). They've done it before and they'll do it again.
londons_explore•2h ago
Imagine a world where the page size is secret to userspace. Anything that needs page size alignment will be chosen by the kernel.
That in turn allows mixed page size, variable page size, heirarchical pages, etc.
Dylan16807•2h ago
duskwuff•2h ago
viraptor•2h ago
londons_explore•27m ago
But when someone releases a new CPU with a larger or smaller cache, all old software continues to work.
Secret page size would offer the same benefit.
londons_explore•28m ago
londons_explore•24m ago
And that 'copy' might be zero-overhead remapping of the original pages.