|
|
Log in / Subscribe / Register

mm: Introduce section-based vmemmap optimization for HugeTLB

From:  Muchun Song <songmuchun-AT-bytedance.com>
To:  Andrew Morton <akpm-AT-linux-foundation.org>, Oscar Salvador <osalvador-AT-suse.de>, David Hildenbrand <david-AT-kernel.org>, linux-mm-AT-kvack.org
Subject:  [PATCH 00/17] mm: Introduce section-based vmemmap optimization for HugeTLB
Date:  Thu, 02 Jul 2026 17:38:04 +0800
Message-ID:  <20260702093821.2740183-1-songmuchun@bytedance.com>
Cc:  Mike Rapoport <rppt-AT-kernel.org>, Vlastimil Babka <vbabka-AT-kernel.org>, Lorenzo Stoakes <ljs-AT-kernel.org>, Michal Hocko <mhocko-AT-suse.com>, linux-kernel-AT-vger.kernel.org, Muchun Song <songmuchun-AT-bytedance.com>, muchun.song-AT-linux.dev
Archive-link:  Article

This series is split out from the earlier, larger series "mm: Generalize
HVO for HugeTLB and device DAX" [1]. While the parent series generalizes
vmemmap optimization across HugeTLB and device DAX, this subset addresses
a single, self-contained step: making the generic sparse-vmemmap code
section-based optimization aware and switching HugeTLB bootmem pages to
this path.

HugeTLB vmemmap optimization currently has its own early boot setup
path.  It pre-populates optimized vmemmap mappings before the normal
sparse-vmemmap population code runs, and sparsemem carries
SPARSEMEM_VMEMMAP_PREINIT only to support that special case.

That makes the HugeTLB vmemmap optimization path harder to share with
other users of sparse-vmemmap optimization and leaves a fair amount of
HugeTLB-specific boot-time state in the generic memory initialization
flow.

This series introduces section-based vmemmap optimization support in
the sparse-vmemmap code and switches HugeTLB bootmem pages over to it.
Instead of having HugeTLB pre-populate optimized vmemmap mappings
itself, HugeTLB now records the compound page order in the corresponding
memory sections.  The generic sparse-vmemmap population path can then
allocate or reuse shared tail vmemmap pages based on section metadata.

The patches are organized as follows:

  - patches 1-3 prepare sparsemem and vmemmap optimization metadata
  - patches 4-7 teach the common sparse-vmemmap paths to use that state
  - patches 8-9 switch HugeTLB bootmem optimization to the section-based path
  - patches 10-17 clean up sparsemem and HugeTLB bootmem code that is no
    longer needed after the conversion

This is intended to be the second smaller step toward the broader HVO
generalization.  The device DAX conversion and the wider HVO
consolidation are left for follow-up series.

[1] https://lore.kernel.org/linux-mm/20260513130542.35604-1-s...

Muchun Song (17):
  mm/sparse: drop power-of-2 size requirement for struct mem_section
  mm/sparse-vmemmap: track compound page order in struct mem_section
  mm/sparse-vmemmap: introduce folio-oriented vmemmap optimization
    macros
  mm/mm_init: skip initializing shared vmemmap tail pages
  mm/sparse-vmemmap: initialize shared tail vmemmap pages on allocation
  mm/sparse-vmemmap: support section-based vmemmap accounting
  mm/sparse-vmemmap: support section-based vmemmap optimization
  mm/sparse: mark memory sections present earlier
  mm/hugetlb: switch HugeTLB to section-based vmemmap optimization
  mm/mm_init: factor out pfn_to_zone()
  mm/sparse-vmemmap: remove SPARSEMEM_VMEMMAP_PREINIT support
  mm/sparse: inline usemap allocation into sparse_init_nid()
  mm/sparse: remove section_map_size()
  mm/hugetlb: remove HUGE_BOOTMEM_HVO
  mm/hugetlb: remove HUGE_BOOTMEM_CMA
  mm/hugetlb: localize struct huge_bootmem_page
  mm/hugetlb: localize HUGE_BOOTMEM_ZONES_VALID

 arch/x86/Kconfig        |   1 -
 fs/Kconfig              |   1 -
 include/linux/hugetlb.h |   9 +--
 include/linux/mm.h      |   4 --
 include/linux/mmzone.h  | 113 ++++++++++++++++++++++-------------
 mm/Kconfig              |   5 --
 mm/bootmem_info.c       |   5 +-
 mm/hugetlb.c            |  63 +++++---------------
 mm/hugetlb_vmemmap.c    | 123 +++++---------------------------------
 mm/hugetlb_vmemmap.h    |  13 ++--
 mm/internal.h           |  29 ++++++---
 mm/mm_init.c            |  54 ++++++++++++-----
 mm/sparse-vmemmap.c     | 128 +++++++++++++---------------------------
 mm/sparse.c             | 102 ++++++++++++--------------------
 scripts/gdb/linux/mm.py |   6 +-
 15 files changed, 254 insertions(+), 402 deletions(-)


base-commit: 4f441960e691d37c880d2cc004de06bb5b6bd5e4
-- 
2.54.0



Copyright © 2026, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds