[PATCH v2 0/3] memblock: Remove unused exact nid allocation API

From: Kaitao Cheng

Date: Sat Sep 19 2026 - 09:53:53 EST


Commit ffe55393137c ("mm/sparse: remove sparse buffer pre-allocation
mechanism") removed the only memmap_alloc() caller that requested an
allocation from an exact NUMA node. All remaining callers allow fallback
to other nodes, leaving the exact_nid argument unused.

Remove the argument from memmap_alloc(). This leaves
memblock_alloc_exact_nid_raw() without any in-kernel callers, so move the
applicable exact-node allocation tests to memblock_alloc_range_nid() and
remove the unused API. Also remove the exact_nid argument from the internal
allocation helper, since all of its remaining callers allow fallback.

Exact-node allocation remains a required behavior of
memblock_alloc_range_nid(). CMA uses it when reserving per-node CMA areas;
allowing fallback could leave the area's recorded nid inconsistent with
the physical location of its memory. KHO also uses it for per-node scratch
areas that must remain on the requested node. Therefore, retain coverage
of this behavior by making the applicable NUMA tests call
memblock_alloc_range_nid() directly with exact_nid set.

The tests that exercise memblock_alloc_internal() retrying below min_addr
cannot be retained unchanged. Unlike memblock_alloc_internal(),
memblock_alloc_range_nid() treats its start address as a hard boundary and
does not retry from address zero. Remove those tests along with the now
unused TEST_F_EXACT dispatch from the shared allocation tests.

Kaitao Cheng (3):
mm: Remove unused exact_nid parameter from memmap_alloc()
memblock tests: Move exact nid tests to memblock_alloc_range_nid()
memblock: Remove unused memblock_alloc_exact_nid_raw()

include/linux/memblock.h | 3 -
mm/memblock.c | 44 +-
mm/mm_init.c | 14 +-
mm/mm_init.h | 4 +-
mm/sparse-vmemmap.c | 2 +-
mm/sparse.c | 2 +-
.../memblock/tests/alloc_exact_nid_api.c | 454 ++----------------
tools/testing/memblock/tests/alloc_nid_api.c | 20 -
tools/testing/memblock/tests/alloc_nid_api.h | 1 -
tools/testing/memblock/tests/common.h | 2 -
10 files changed, 50 insertions(+), 496 deletions(-)

--
2.54.0 (Apple Git-157)