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

From: Kaitao Cheng

Date: Thu Sep 17 2026 - 04:21:00 EST


This series follows the removal of the unused exact_nid argument from
memmap_alloc(). That change removed the last in-kernel caller of
memblock_alloc_exact_nid_raw(), leaving only the memblock simulator
tests using the function.

The first patch moves the applicable exact-node allocation tests to
memblock_alloc_range_nid(). The second patch removes
memblock_alloc_exact_nid_raw() and drops the exact_nid argument from
memblock_alloc_internal(), as all of its remaining callers allow
fallback to other NUMA nodes.

The investigation cannot be extended to removing the exact_nid argument
from memblock_alloc_range_nid(). CMA passes true when reserving per-node
CMA areas. Allowing such an allocation to fall back to another node
could leave the CMA area's recorded nid inconsistent with the physical
location of its memory. KHO also passes true when allocating per-node
scratch areas and requires those allocations to remain on the requested
node.

Since exact-node allocation remains a required behavior of
memblock_alloc_range_nid(), deleting all of the tests in
alloc_exact_nid_api.c would remove useful coverage. Preserve the
applicable NUMA tests by making them call memblock_alloc_range_nid()
directly with exact_nid set.

Some tests cannot be preserved unchanged because they exercise
memblock_alloc_internal() retrying below min_addr. 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 together with the now-unused TEST_F_EXACT dispatch from the
shared allocation tests.

Kaitao Cheng (2):
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 +-
.../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 -
6 files changed, 42 insertions(+), 482 deletions(-)

--
2.54.0 (Apple Git-157)