Thread (39 messages) 39 messages, 4 authors, 7d ago

Re: [PATCH v5 01/12] mm/sparse-vmemmap: factor out shared vmemmap tail page allocation

flat view

From: Muchun Song <muchun.song@linux.dev>
Date: 2026-09-29 07:55:49
Also in: linux-doc, linux-mm, lkml

On Sep 29, 2026, at 15:16, David Hildenbrand (Arm) [off-list ref] wrote:

On 9/27/26 04:54, Muchun Song wrote:
quoted
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(), initializes the tail
struct pages, and uses cmpxchg() to install the per-zone shared page.

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

Signed-off-by: Muchun Song <redacted>
Acked-by: Qi Zheng <qi.zheng@linux.dev>
Acked-by: Mike Rapoport (Microsoft) <rppt@kernel.org>
---
v5:
- Move this patch before CONFIG_VMEMMAP_OPTIMIZATION is introduced

v4:
- Update the commit message for the renamed VMEMMAP_OPTIMIZATION config
- Collect Acked-by from Mike Rapoport

v2:
- Collect Acked-by from Qi Zheng
---
[...]
quoted
#ifdef CONFIG_HUGETLB_PAGE_OPTIMIZE_VMEMMAP
-static __meminit struct page *vmemmap_get_tail(unsigned int order, struct zone *zone)
+struct page __ref *vmemmap_shared_tail_page(unsigned int order, struct zone *zone)
{
- 	struct page *p, *tail;
- 	unsigned int idx;
- 	int node = zone_to_nid(zone);
+ 	void *addr;
+ 	struct page *page;
+ 	const unsigned int idx = order - VMEMMAP_OPTIMIZATION_MIN_ORDER;
Nit: constants read much nicer all the way at the top.
I can update to this next version.

Acked-by: David Hildenbrand (Arm) <david@kernel.org>
Thanks.
-- 
Cheers,

David

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