diff -urN linux-2.6.17-mm1-orig/arch/x86_64/mm/srat.c linux-2.6.17-mm1/arch/x86_64/mm/srat.c --- linux-2.6.17-mm1-orig/arch/x86_64/mm/srat.c 2006-06-23 16:12:00.000000000 -0400 +++ linux-2.6.17-mm1/arch/x86_64/mm/srat.c 2006-06-23 18:43:03.000000000 -0400 @@ -34,9 +34,6 @@ static struct bootnode nodes_add[MAX_NUMNODES] __initdata; static int found_add_area __initdata; int hotadd_percent __initdata = 0; -#ifndef RESERVE_HOTADD -#define hotadd_percent 0 /* Ignore all settings */ -#endif /* Too small nodes confuse the VM badly. Usually they result from BIOS bugs. */ @@ -199,9 +196,9 @@ allocated += mem; return 1; } - +#endif /* - * It is fine to add this area to the nodes data it will be used later + * It is fine to add this area to the nodes_add data it will be used later * This code supports one contigious hot add area per node. */ static int reserve_hotadd(int node, unsigned long start, unsigned long end) @@ -227,15 +224,14 @@ printk(KERN_ERR "SRAT: Hotplug area has existing memory\n"); return -1; } - +#ifdef RESERVE_HOTADD if (!hotadd_enough_memory(&nodes_add[node])) { printk(KERN_ERR "SRAT: Hotplug area too large\n"); return -1; } - +#endif /* Looks good */ - found_add_area = 1; if (nd->start == nd->end) { nd->start = start; nd->end = end; @@ -253,14 +249,16 @@ printk(KERN_ERR "SRAT: Hotplug zone not continuous. Partly ignored\n"); } - if ((nd->end >> PAGE_SHIFT) > end_pfn) - end_pfn = nd->end >> PAGE_SHIFT; - if (changed) printk(KERN_INFO "SRAT: hot plug zone found %Lx - %Lx\n", nd->start, nd->end); +#ifdef RESERVE_HOTADD + found_add_area = 1; + if ((nd->end >> PAGE_SHIFT) > end_pfn) + end_pfn = nd->end >> PAGE_SHIFT; return 0; +#endif + return -1; } -#endif /* Callback for parsing of the Proximity Domain <-> Memory Area mappings */ void __init @@ -318,7 +316,6 @@ printk(KERN_INFO "SRAT: Node %u PXM %u %Lx-%Lx\n", node, pxm, nd->start, nd->end); -#ifdef RESERVE_HOTADD if (ma->flags.hot_pluggable && reserve_hotadd(node, start, end) < 0) { /* Ignore hotadd region. Undo damage */ printk(KERN_NOTICE "SRAT: Hotplug region ignored\n"); @@ -326,7 +323,6 @@ if ((nd->start | nd->end) == 0) node_clear(node, nodes_parsed); } -#endif } /* Sanity check to catch more bad SRATs (they are amazingly common). @@ -450,3 +446,14 @@ } EXPORT_SYMBOL(__node_distance); + +int arch_find_node(unsigned long start, unsigned long size) { + int i, ret = 0; + unsigned long end = start+size; + + for_each_node(i){ + if (nodes_add[i].start <= start && nodes_add[i].end >= end) + ret = i; + } + return ret; +}