[RFC PATCH 4/8] arch_numa: Avoid onlining empty NUMA nodes

Jonathan Cameron Jonathan.Cameron at huawei.com
Wed May 29 10:12:32 PDT 2024


ACPI can declare NUMA nodes for memory that will be along later.
CXL Fixed Memory Windows may also be assigned NUMA nodes that
are initially empty.  Currently the generic arch_numa handling will
online these empty nodes. This is both inconsistent with x86 and
with itself as if we add memory and remove it again the node goes
away.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron at huawei.com>
---
 drivers/base/arch_numa.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/base/arch_numa.c b/drivers/base/arch_numa.c
index 5b59d133b6af..0630efb696ab 100644
--- a/drivers/base/arch_numa.c
+++ b/drivers/base/arch_numa.c
@@ -363,6 +363,11 @@ static int __init numa_register_nodes(void)
 		unsigned long start_pfn, end_pfn;
 
 		get_pfn_range_for_nid(nid, &start_pfn, &end_pfn);
+		if (start_pfn >= end_pfn &&
+		    !node_state(nid, N_CPU) &&
+		    !node_state(nid, N_GENERIC_INITIATOR))
+			continue;
+
 		setup_node_data(nid, start_pfn, end_pfn);
 		node_set_online(nid);
 	}
-- 
2.39.2




More information about the linux-arm-kernel mailing list