Skip to contentSkip to conversation

Patch [2/4] x86_64 sparsmem add - implement arch_find_node in memory_hotplug code.

RFC In review keith mannthey 2 participants 2 messages Jun 24, 2006

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

RFC 1/1 Patch [2/4] x86_64 sparsmem add - implement arch_find_node in memory_hotplug code.

The current MEMORY_HOTPLUG code expects that the ACPI layer (for the
Intel space) will pass along the _PXM data (this is node locality data). This is an optional field for the acpi namespace and one which Linux should not require for hot-add memory.

This patch creates uses the arch_find_node function and wedges it into
the generic add_memory function. When the acpi can't resolve the _PXM data (as in my hardware event) it returns -1. I build a check into add_memory that looks for invalid data passes id < 0 and calls arch_find_node.

I intend to implement an arch_find_node for i386 in the near
future.

arch/x86_64/Kconfig +4 -0
diff -urN linux-2.6.17-mm1-orig/arch/x86_64/Kconfig linux-2.6.17-mm1/arch/x86_64/Kconfig
@@ -335,6 +335,10 @@
 	def_bool y
 	depends on MEMORY_HOTPLUG
 
+config ARCH_FIND_NODE
+	def_bool y
+	depends on MEMORY_HOTPLUG
+
 config ARCH_FLATMEM_ENABLE
 	def_bool y
 	depends on !NUMA
include/linux/memory_hotplug.h +5 -1
diff -urN linux-2.6.17-mm1-orig/include/linux/memory_hotplug.h linux-2.6.17-mm1/include/linux/memory_hotplug.h
@@ -132,7 +132,11 @@
 }
 #endif /* CONFIG_NUMA */
 #endif /* CONFIG_HAVE_ARCH_NODEDATA_EXTENSION */
-
+#ifdef CONFIG_ARCH_FIND_NODE
+	extern int arch_find_node(unsigned long, unsigned long);
+#else
+	static inline int arch_find_node(unsigned long a,  unsigned long b) {return 0;}
+#endif
 #else /* ! CONFIG_MEMORY_HOTPLUG */
 /*
  * Stub functions for when hotplug is off
mm/memory_hotplug.c +7 -2
diff -urN linux-2.6.17-mm1-orig/mm/memory_hotplug.c linux-2.6.17-mm1/mm/memory_hotplug.c
@@ -234,12 +234,17 @@
 
 
 
-int add_memory(int nid, u64 start, u64 size)
+int add_memory(int node, u64 start, u64 size)
 {
 	pg_data_t *pgdat = NULL;
 	int new_pgdat = 0;
-	int ret;
+	int ret,nid;
 
+	if (node < 0) 
+		nid = arch_find_node(start,size);
+	else
+		nid = node;
+	
 	if (!node_online(nid)) {
 		pgdat = hotadd_new_pgdat(nid, start);
 		if (!pgdat)
#1 lore raw

Hi,

Quoted 3 lines · On Fri, 23 Jun 2006 19:05:48 -0700 keith mannthey <[email protected]> wrote:

I intend to implement an arch_find_node for i386 in the near
future.

ya, welcome :)

Quoted 3 lines

+config ARCH_FIND_NODE
+ def_bool y
+ depends on MEMORY_HOTPLUG
+

maybe
--
depends on MEMORY_HOTPLUG && NUMA
--
is better.

-Kame

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>