diff mbox series

[v2,8/8] mm/memblock: default region's nid may be MAX_NUMNODES

Message ID 20240425071929.18004-9-richard.weiyang@gmail.com (mailing list archive)
State New
Headers show
Series memblock: clenup | expand

Commit Message

Wei Yang April 25, 2024, 7:19 a.m. UTC
On x86, the call flow looks like this:

numa_init()
    memblock_set_node(..., MAX_NUMNODES)
    numa_register_memblks()
        memblock_validate_numa_coverage()

If there is a hole, the nid for this region would stay to be
MAX_NUMNODES. Then memblock_validate_numa_coverage() will miss to report
it.

Signed-off-by: Wei Yang <richard.weiyang@gmail.com>
---
 mm/memblock.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/mm/memblock.c b/mm/memblock.c
index 9b4fa8fea9a2..3f142c787491 100644
--- a/mm/memblock.c
+++ b/mm/memblock.c
@@ -759,7 +759,7 @@  bool __init_memblock memblock_validate_numa_coverage(unsigned long threshold_byt
 
 	/* calculate lose page */
 	for_each_mem_pfn_range(i, MAX_NUMNODES, &start_pfn, &end_pfn, &nid) {
-		if (nid == NUMA_NO_NODE)
+		if (nid == MAX_NUMNODES || nid == NUMA_NO_NODE)
 			nr_pages += end_pfn - start_pfn;
 	}