diff -urN linux-2.6.17-mm1-orig/arch/x86_64/Kconfig linux-2.6.17-mm1/arch/x86_64/Kconfig --- linux-2.6.17-mm1-orig/arch/x86_64/Kconfig 2006-06-23 16:12:00.000000000 -0400 +++ linux-2.6.17-mm1/arch/x86_64/Kconfig 2006-06-23 20:35:03.000000000 -0400 @@ -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 diff -urN linux-2.6.17-mm1-orig/include/linux/memory_hotplug.h linux-2.6.17-mm1/include/linux/memory_hotplug.h --- linux-2.6.17-mm1-orig/include/linux/memory_hotplug.h 2006-06-23 16:12:09.000000000 -0400 +++ linux-2.6.17-mm1/include/linux/memory_hotplug.h 2006-06-23 20:35:03.000000000 -0400 @@ -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 diff -urN linux-2.6.17-mm1-orig/mm/memory_hotplug.c linux-2.6.17-mm1/mm/memory_hotplug.c --- linux-2.6.17-mm1-orig/mm/memory_hotplug.c 2006-06-23 16:12:10.000000000 -0400 +++ linux-2.6.17-mm1/mm/memory_hotplug.c 2006-06-23 20:35:03.000000000 -0400 @@ -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)