Speaker
Description
On supported configurations, the direct map is built using large
PMD/PUD-level block mappings. This is expected to bring many of the
benefits of hugepages: improved TLB hit rate, less page table walking,
smaller page table memory footprint.
This optimisation is most effective when the direct map gives access to
the entire physical memory with uniform permissions. Unfortunately, a
growing number of features need to remove pages from the direct map or
modify permissions/attributes at page granularity, causing PMD/PUD
blocks to be split down to PTEs.
According to results presented by Mike Rapoport at LSF/MM 2023 [1], the
performance impact of such fragmentation is negligible for data
accesses. However, recent measurements on x86 and arm64 suggest a more
nuanced picture, and other factors such as power consumption should also
be considered.
This session will briefly summarise key results, and then discuss
possible ways to reduce fragmentation.
Questions for discussion:
- Should direct map permissions be modelled as an allocation property
in the buddy allocator, or managed by higher-level interfaces such as
execmem or secretmem? - Can x86 and arm64 use common logic for splitting and coalescing pages?
A few interesting sources of direct map fragmentation:
- execmem (may use PMD-sized pools; direct map PMDs will still be split
if writing code) - secretmem
- Confidential VMs including guest_memfd (encrypted/unmapped pages)
- pkeys-based page table protection
Proposals to reduce fragmentation:
- 2021/01 - PMD-sized pools for secretmem [2]
- 2021/04 - Grouped vmalloc [3]
- 2023/03 -
__GFP_UNMAPPEDbased on dedicated cache [4] - 2026/02 - pkeys-protected page table pools [5]
- 2026/03 -
__GFP_UNMAPPEDbased on migratype/pageblock [6] - 2026/06 - Collapsing blocks in secretmem [7]
- 2026/06 - EXECMEM_ROX_CACHE for arm64 with direct map PMD coalescing [8]
[1] https://lwn.net/Articles/931406/
[2] https://lore.kernel.org/lkml/20210121122723.3446-8-rppt@kernel.org/
[3] https://lore.kernel.org/lkml/20210405203711.1095940-1-rick.p.edgecombe@intel.com/
[4] https://lore.kernel.org/all/20230308094106.227365-1-rppt@kernel.org/
[5] https://lore.kernel.org/linux-hardening/20260227175518.3728055-1-kevin.brodsky@arm.com/
[6] https://lore.kernel.org/lkml/20260320-page_alloc-unmapped-v2-0-28bf1bd54f41@google.com/
[7] https://lore.kernel.org/all/20260603104624.36390-1-lance.yang@linux.dev/
[8] https://lore.kernel.org/all/20260611130144.1385343-1-abarnas@google.com/