Re: [PATCH 0/4] mm: speed up ZONE_DEVICE memmap initialization
From: Mike Rapoport
Date: Mon May 18 2026 - 02:36:01 EST
Hi,
On Fri, May 15, 2026 at 04:20:41PM +0800, Li Zhe wrote:
> memmap_init_zone_device() can spend a substantial amount of time
> initializing large ZONE_DEVICE ranges because it repeats nearly
> identical struct page setup for every PFN.
>
> This series reduces that overhead in four steps.
>
> Testing
> =======
>
> Tests were run in a VM on an Intel Ice Lake server.
>
> Two PMEM configurations were used:
> - a 100 GB fsdax namespace configured with map=dev, which exercises
> the nd_pmem rebind path (pfns_per_compound == 1)
> - a 100 GB devdax namespace configured with align=2097152, which
> exercises the dax_pmem rebind path (pfns_per_compound > 1)
>
> For each configuration, the corresponding driver was unbound and
> rebound 30 times. Memmap initialization latency was collected from the
> pr_debug() output of memmap_init_zone_device().
>
> The first bind is reported separately, and the average of subsequent
> rebinds is used as the steady-state result.
>
> Performance
> ===========
> nd_pmem rebind, 100 GB fsdax namespace, map=dev
> Base(v7.1-rc3):
> First binding: 1486 ms
> Average of subsequent rebinds: 273.52 ms
> Full series:
> First binding: 1272 ms
> Average of subsequent rebinds: 104.59 ms
>
> dax_pmem rebind, 100 GB devdax namespace, align=2097152
> Base(v7.1-rc3):
> First binding: 1515 ms
> Average of subsequent rebinds: 313.45 ms
> Full series:
> First binding: 1286 ms
> Average of subsequent rebinds: 116.93 ms
This is really good improvement!
It would be also interesting to see how the template approach would improve
"normal" memory map initialization.
> Li Zhe (4):
> mm: factor zone-device page init helpers out of
> __init_zone_device_page
> mm: add a template-based fast path for zone-device page init
> mm: extend the template fast path to zone-device compound tails
> mm: use arch store helpers in zone-device template copies
>
> arch/x86/include/asm/struct_page_init.h | 28 +++
> include/asm-generic/Kbuild | 1 +
> include/asm-generic/struct_page_init.h | 17 ++
> mm/mm_init.c | 260 +++++++++++++++++++++---
> 4 files changed, 280 insertions(+), 26 deletions(-)
> create mode 100644 arch/x86/include/asm/struct_page_init.h
> create mode 100644 include/asm-generic/struct_page_init.h
>
> --
> 2.20.1
>
--
Sincerely yours,
Mike.