On Tue, Jul 15, 2025 at 04:16:44PM +0200, David Hildenbrand wrote: > On 15.07.25 16:12, Lorenzo Stoakes wrote: > > On Tue, Jul 15, 2025 at 04:06:29PM +0200, David Hildenbrand wrote: > > > I think at some point we discussed "when does the PMD-sized zeropage make > > > *any* sense on these weird arch configs" (512MiB on arm64 64bit) > > > > > > No idea who wants to waste half a gig on that at runtime either. > > > > Yeah this is a problem we _really_ need to solve. But obviously somewhat out of > > scope here. > > > > > > > > But yeah, we should let the arch code opt in whether it wants it or not (in > > > particular, maybe only on arm64 with CONFIG_PAGE_SIZE_4K) > > > > I don't think this should be an ARCH_HAS_xxx. > > > > Because that's saying 'this architecture has X', this isn't architecture > > scope. > > > > I suppose PMDs may vary in terms of how huge they are regardless of page > > table size actually. > > > > So maybe the best solution is a semantic one - just rename this to > > ARCH_WANT_STATIC_PMD_ZERO_PAGE > > > > And then put the page size selector in the arch code. > > > > For example in arm64 we have: > > > > select ARCH_WANT_HUGE_PMD_SHARE if ARM64_4K_PAGES || (ARM64_16K_PAGES && !ARM64_VA_BITS_36) > > > > So doing something similar here like: > > > > select ARCH_WANT_STATIC_PMD_ZERO_PAGE if ARM64_4K_PAGES > > > > Would do thie job and sort everything out. > > Yes. Actually I had something similar in one of my earlier versions[1] where we can opt in from arch specific Kconfig with *WANT* instead *HAS*. For starters, I will enable this only from x86. We can probably extend this once we get the base patches up. [1] https://lore.kernel.org/linux-mm/20250522090243.758943-2-p.raghav@xxxxxxxxxxx/ -- Pankaj