Re: [PATCH] mm: Remove unused exact_nid parameter from memmap_alloc()

From: Andrew Morton

Date: Tue Sep 15 2026 - 00:24:34 EST


On Mon, 14 Sep 2026 13:51:30 +0800 Kaitao Cheng <kaitao.cheng@xxxxxxxxx> wrote:

> From: Kaitao Cheng <chengkaitao@xxxxxxxxxx>
>
> Commit ffe55393137c ("mm/sparse: remove sparse buffer pre-allocation
> mechanism") removed sparse_buffer_init(), which was the only caller of
> memmap_alloc() that passed true for exact_nid.
>
> All remaining callers pass false, leaving the exact-node allocation
> branch unreachable. Remove the exact_nid parameter and unconditionally
> use memblock_alloc_try_nid_raw().
>
> This has no functional impact.
>

Latest development code has changed quite lot, but this was an easy reject
to fix:

> --- a/mm/sparse-vmemmap.c
> +++ b/mm/sparse-vmemmap.c
> @@ -53,7 +53,7 @@ static void * __ref __earlyonly_bootmem_alloc(int node,
> unsigned long align,
> unsigned long goal)
> {
> - return memmap_alloc(size, align, goal, node, false);
> + return memmap_alloc(size, align, goal, node);
> }
>
> void * __meminit vmemmap_alloc_block(unsigned long size, int node)


--- a/mm/sparse.c~mm-remove-unused-exact_nid-parameter-from-memmap_alloc
+++ a/mm/sparse.c
@@ -215,7 +215,7 @@ struct page __init *__populate_section_m
{
const unsigned long size = PAGE_ALIGN(sizeof(struct page) * PAGES_PER_SECTION);

- return memmap_alloc(size, size, __pa(MAX_DMA_ADDRESS), nid, false);
+ return memmap_alloc(size, size, __pa(MAX_DMA_ADDRESS), nid);
}
#endif /* !CONFIG_SPARSEMEM_VMEMMAP */