diff -urN orig/include/linux/memory_hotplug.h work/include/linux/memory_hotplug.h --- orig/include/linux/memory_hotplug.h 2006-07-28 13:57:37.000000000 -0400 +++ work/include/linux/memory_hotplug.h 2006-07-26 20:18:35.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 orig/mm/memory_hotplug.c work/mm/memory_hotplug.c --- orig/mm/memory_hotplug.c 2006-07-28 13:57:38.000000000 -0400 +++ work/mm/memory_hotplug.c 2006-07-26 20:18:35.000000000 -0400 @@ -233,12 +233,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)