Re: [PATCH 00/49] mm: Generalize vmemmap optimization for DAX and HugeTLB

Mike Rapoport
2026-04-05T13:35:06Z

Hi Muchun,

On Sun, Apr 05, 2026 at 08:51:51PM +0800, Muchun Song wrote:
> Overview:
> This patch series generalizes the HugeTLB Vmemmap Optimization (HVO)
> into a generic vmemmap optimization framework that can be used by both
> HugeTLB and DAX.
>
> Background:
> Currently, the vmemmap optimization feature is highly coupled with
> HugeTLB. However, DAX also has similar requirements for optimizing vmemmap
> pages to save memory. The current implementation has separate vmemmap
> optimization paths for HugeTLB and DAX, leading to duplicated logic,
> complex initialization sequences, and architecture-specific flags.
>
> Implementation:
> This series breaks down the optimization into a generic framework:
> - Patch 1-6: Fix bugs related to sparse vmemmap initialization and DAX.
> - Patch 7-13: Refactor the existing sparse vmemmap initialization.
> - Patch 14-26: Decouple the vmemmap optimization from HugeTLB and
> introduce generic optimization macros and functions.
> - Patch 27-39: Switch HugeTLB and DAX to use the generic framework.
> - Patch 40-49: Clean up the old HVO-specific code and simplify it.
>
> Benifit:
> - When CONFIG_DEFERRED_STRUCT_PAGE_INIT is disabled, all struct pages
> utilizing HVO (HugeTLB Vmemmap Optimization) skip initialization in
> memmap_init, significantly accelerating boot times.
> - All architectures supporting HVO benefit from the optimizations
> provided by SPARSEMEM_VMEMMAP_PREINIT without requiring
> architecture-specific adaptations.
> - Device DAX struct page savings are further improved, saving an
> additional 4KB of struct page memory for every 2MB huge page.
> - Vmemmap tail pages used for Device DAX shared mappings are changed
> from read-write to read-only, enhancing system security.
> - HugeTLB and Device DAX now share a unified vmemmap optimization
> framework, reducing long-term maintenance overhead.

This looks very interesting ...

> 32 files changed, 513 insertions(+), 1197 deletions(-)

... and nicely cleaning up things.

This series is high on my TODO list, but most likely I won't have time for
proper review until after -rc1.

--
Sincerely yours,
Mike.