Re: [PATCH v3 07/11] mm/hugetlb: use common compound page initialization helper
From: Qi Zheng
Date: Mon Nov 23 2026 - 02:36:58 EST
On 11/20/26 6:08 PM, Muchun Song wrote:
Boot-time gigantic hugetlb folios currently use a separate path to
initialize their compound struct pages.
Use memmap_init_compound_page() for these folios so that HugeTLB and
ZONE_DEVICE share the common compound page initialization path. This
removes the HugeTLB-specific implementation and improves initialization
performance.
ZONE_DEVICE initializes struct pages by walking one contiguous memory
range. Boot-time HugeTLB instead initializes multiple disjoint ranges,
one for each contiguous hugepage. Measurements showed that memcpy()
performed better than memcpy_nontemporal() for the latter access pattern.
Therefore, use memcpy() for normal memory while retaining
memcpy_nontemporal() for ZONE_DEVICE.
The initialization time for 64 boot-time 1G hugepages with 4K base
pages was measured as follows:
arch without this patch with this patch reduction
x86-64 195.60 ms 170.40 ms 12.88%
arm64 374.40 ms 237.60 ms 36.54%
Co-developed-by: Li Zhe <lizhe.67@xxxxxxxxxxxxx>
Signed-off-by: Li Zhe <lizhe.67@xxxxxxxxxxxxx>
Signed-off-by: Muchun Song <songmuchun@xxxxxxxxxxxxx>
---
v3:
- Integrate the template-copy optimization into the common helper switch
(suggested by Mike Rapoport)
- Use memcpy() for normal memory and keep memcpy_nontemporal() for
ZONE_DEVICE
- Update performance results for the integrated implementation (measured
by Li Zhe)
- Add Co-developed-by for Li Zhe
---
mm/hugetlb.c | 52 ++--------------------------------------------------
Glad to see this.
mm/mm_init.c | 10 ++++++----
2 files changed, 8 insertions(+), 54 deletions(-)
LGTM, so:
Reviewed-by: Qi Zheng <qi.zheng@xxxxxxxxx>
Thanks,
Qi