x86: Use memblock to replace early_res
[cascardo/linux.git] / arch / x86 / mm / numa_64.c
index 8948f47..3d54f9f 100644 (file)
@@ -7,6 +7,7 @@
 #include <linux/string.h>
 #include <linux/init.h>
 #include <linux/bootmem.h>
+#include <linux/memblock.h>
 #include <linux/mmzone.h>
 #include <linux/ctype.h>
 #include <linux/module.h>
@@ -33,9 +34,6 @@ int numa_off __initdata;
 static unsigned long __initdata nodemap_addr;
 static unsigned long __initdata nodemap_size;
 
-DEFINE_PER_CPU(int, node_number) = 0;
-EXPORT_PER_CPU_SYMBOL(node_number);
-
 /*
  * Map cpu index to node index
  */
@@ -174,8 +172,8 @@ static void * __init early_node_mem(int nodeid, unsigned long start,
        if (start < (MAX_DMA32_PFN<<PAGE_SHIFT) &&
            end > (MAX_DMA32_PFN<<PAGE_SHIFT))
                start = MAX_DMA32_PFN<<PAGE_SHIFT;
-       mem = find_e820_area(start, end, size, align);
-       if (mem != -1L)
+       mem = memblock_x86_find_in_range_node(nodeid, start, end, size, align);
+       if (mem != MEMBLOCK_ERROR)
                return __va(mem);
 
        /* extend the search scope */
@@ -184,8 +182,8 @@ static void * __init early_node_mem(int nodeid, unsigned long start,
                start = MAX_DMA32_PFN<<PAGE_SHIFT;
        else
                start = MAX_DMA_PFN<<PAGE_SHIFT;
-       mem = find_e820_area(start, end, size, align);
-       if (mem != -1L)
+       mem = memblock_x86_find_in_range_node(nodeid, start, end, size, align);
+       if (mem != MEMBLOCK_ERROR)
                return __va(mem);
 
        printk(KERN_ERR "Cannot find %lu bytes in node %d\n",
@@ -809,7 +807,7 @@ void __cpuinit numa_set_node(int cpu, int node)
        per_cpu(x86_cpu_to_node_map, cpu) = node;
 
        if (node != NUMA_NO_NODE)
-               per_cpu(node_number, cpu) = node;
+               set_cpu_numa_node(cpu, node);
 }
 
 void __cpuinit numa_clear_node(int cpu)
@@ -867,7 +865,7 @@ void __cpuinit numa_remove_cpu(int cpu)
        numa_set_cpumask(cpu, 0);
 }
 
-int cpu_to_node(int cpu)
+int __cpu_to_node(int cpu)
 {
        if (early_per_cpu_ptr(x86_cpu_to_node_map)) {
                printk(KERN_WARNING
@@ -877,7 +875,7 @@ int cpu_to_node(int cpu)
        }
        return per_cpu(x86_cpu_to_node_map, cpu);
 }
-EXPORT_SYMBOL(cpu_to_node);
+EXPORT_SYMBOL(__cpu_to_node);
 
 /*
  * Same function as cpu_to_node() but used if called before the