[RFC PATCH 5/8] arch_numa: Make numa_add_memblk() set nid for memblock.reserved regions

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


Setting the reserved region entries to the appropriate Node ID means
that they can be used to establish the node to which we should add
hotplugged CXL memory within a CXL fixed memory window.

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

diff --git a/drivers/base/arch_numa.c b/drivers/base/arch_numa.c
index 0630efb696ab..568dbabeb636 100644
--- a/drivers/base/arch_numa.c
+++ b/drivers/base/arch_numa.c
@@ -208,6 +208,13 @@ int __init numa_add_memblk(int nid, u64 start, u64 end)
 			start, (end - 1), nid);
 		return ret;
 	}
+	/* Also set reserved nodes nid */
+	ret = memblock_set_node(start, (end - start), &memblock.reserved, nid);
+	if (ret < 0) {
+		pr_err("memblock [0x%llx - 0x%llx] failed to add on node %d\n",
+			start, (end - 1), nid);
+		return ret;
+	}
 
 	node_set(nid, numa_nodes_parsed);
 	return ret;
-- 
2.39.2




More information about the linux-arm-kernel mailing list