sparc: Use HAVE_MEMBLOCK_NODE_MAP
authorTejun Heo <tj@kernel.org>
Thu, 8 Dec 2011 18:22:08 +0000 (10:22 -0800)
committerTejun Heo <tj@kernel.org>
Thu, 8 Dec 2011 18:22:08 +0000 (10:22 -0800)
sparc doesn't access early_node_map[] directly and enabling
HAVE_MEMBLOCK_NODE_MAP is trivial - replacing add_active_range() calls
with memblock_set_node() and selecting HAVE_MEMBLOCK_NODE_MAP is
enough.

-v2: Use select in Kconfig instead as suggested by Sam Ravnborg.

Signed-off-by: Tejun Heo <tj@kernel.org>
Acked-by: "David S. Miller" <davem@davemloft.net>
Cc: Sam Ravnborg <sam@ravnborg.org>
Cc: sparclinux@vger.kernel.org
arch/sparc/Kconfig
arch/sparc/mm/init_64.c

index f92602e86607cb094f04ead294b8a3d6f6decdcf..91a6d1e2bf356fd4a409d8fd61d901c0cf7965ae 100644 (file)
@@ -43,6 +43,7 @@ config SPARC64
        select HAVE_KPROBES
        select HAVE_RCU_TABLE_FREE if SMP
        select HAVE_MEMBLOCK
+       select HAVE_MEMBLOCK_NODE_MAP
        select HAVE_SYSCALL_WRAPPERS
        select HAVE_DYNAMIC_FTRACE
        select HAVE_FTRACE_MCOUNT_RECORD
index 29723a2031fc419377f8ad8c98020e1a2a4e9743..b3f5e7dfea51a21a4d2c28ee66518db1336a5023 100644 (file)
@@ -816,7 +816,7 @@ static u64 memblock_nid_range(u64 start, u64 end, int *nid)
 #endif
 
 /* This must be invoked after performing all of the necessary
- * add_active_range() calls for 'nid'.  We need to be able to get
+ * memblock_set_node() calls for 'nid'.  We need to be able to get
  * correct data from get_pfn_range_for_nid().
  */
 static void __init allocate_node_data(int nid)
@@ -987,14 +987,11 @@ static void __init add_node_ranges(void)
 
                        this_end = memblock_nid_range(start, end, &nid);
 
-                       numadbg("Adding active range nid[%d] "
+                       numadbg("Setting memblock NUMA node nid[%d] "
                                "start[%lx] end[%lx]\n",
                                nid, start, this_end);
 
-                       add_active_range(nid,
-                                        start >> PAGE_SHIFT,
-                                        this_end >> PAGE_SHIFT);
-
+                       memblock_set_node(start, this_end - start, nid);
                        start = this_end;
                }
        }
@@ -1282,7 +1279,6 @@ static void __init bootmem_init_nonnuma(void)
 {
        unsigned long top_of_ram = memblock_end_of_DRAM();
        unsigned long total_ram = memblock_phys_mem_size();
-       struct memblock_region *reg;
 
        numadbg("bootmem_init_nonnuma()\n");
 
@@ -1292,20 +1288,8 @@ static void __init bootmem_init_nonnuma(void)
               (top_of_ram - total_ram) >> 20);
 
        init_node_masks_nonnuma();
-
-       for_each_memblock(memory, reg) {
-               unsigned long start_pfn, end_pfn;
-
-               if (!reg->size)
-                       continue;
-
-               start_pfn = memblock_region_memory_base_pfn(reg);
-               end_pfn = memblock_region_memory_end_pfn(reg);
-               add_active_range(0, start_pfn, end_pfn);
-       }
-
+       memblock_set_node(0, (phys_addr_t)ULLONG_MAX, 0);
        allocate_node_data(0);
-
        node_set_online(0);
 }