Thread (17 messages) flat view 17 messages, 3 authors, 20h ago

Re: [PATCH 02/11] mm/sparse-vmemmap: factor out shared vmemmap tail page allocation

From: Qi Zheng <qi.zheng@linux.dev>
Date: 2026-09-01 03:05:37
Also in: linux-doc, linux-mm, lkml


On 8/31/26 3:53 PM, Muchun Song wrote:
HugeTLB and sparse-vmemmap each have their own helper to allocate the
shared vmemmap tail page used by vmemmap optimization.

Factor that logic into a common vmemmap_shared_tail_page() helper. It
allocates the page through vmemmap_alloc_block(), and uses cmpxchg()
to install the per-zone shared page.

Expose zone->vmemmap_tails under CONFIG_SPARSEMEM_VMEMMAP to match the
shared helper's build condition. This avoids a
!CONFIG_SPARSEMEM_VMEMMAP_OPTIMIZATION stub; when optimization is
disabled, the array has no entries and the compiler folds away the unused
paths, so no storage or runtime overhead is added.

This removes duplicate allocation logic while still handling both the
early boot and runtime paths through the same helper.

Signed-off-by: Muchun Song <redacted>
---
  include/linux/mmzone.h |  2 +-
  mm/hugetlb_vmemmap.c   | 28 +---------------
  mm/sparse-vmemmap.c    | 74 +++++++++++++++++-------------------------
  mm/sparse.h            |  1 +
  4 files changed, 33 insertions(+), 72 deletions(-)
Acked-by: Qi Zheng <qi.zheng@linux.dev>

Thanks,
Qi


Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help