[PATCH] x86_64: cleanup setup_node_zones called by paging_init

From: Yinghai Lu
Date: Tue Jan 08 2008 - 22:29:21 EST


[PATCH] x86_64: cleanup setup_node_zones called by paging_init

setup_node_zones calcuates some variable but only use them when FLAT_NODE_MEM_MAP is set

so change the MACRO postion to avoid calculating.

also change it to static

Signed-off-by: Yinghai Lu <yinghai.lu@xxxxxxx>

Index: linux-2.6/arch/x86/mm/numa_64.c
===================================================================
--- linux-2.6.orig/arch/x86/mm/numa_64.c
+++ linux-2.6/arch/x86/mm/numa_64.c
@@ -227,15 +227,16 @@ void __init setup_node_bootmem(int nodei
srat_reserve_add_area(nodeid);
#endif
node_set_online(nodeid);
-}
+}

+#ifdef CONFIG_FLAT_NODE_MEM_MAP
/* Initialize final allocator for a zone */
-void __init setup_node_zones(int nodeid)
-{
+static void __init setup_node_zones(int nodeid)
+{
unsigned long start_pfn, end_pfn, memmapsize, limit;

- start_pfn = node_start_pfn(nodeid);
- end_pfn = node_end_pfn(nodeid);
+ start_pfn = node_start_pfn(nodeid);
+ end_pfn = node_end_pfn(nodeid);

Dprintk(KERN_INFO "Setting up memmap for node %d %lx-%lx\n",
nodeid, start_pfn, end_pfn);
@@ -244,14 +245,13 @@ void __init setup_node_zones(int nodeid)
memory. */
memmapsize = sizeof(struct page) * (end_pfn-start_pfn);
limit = end_pfn << PAGE_SHIFT;
-#ifdef CONFIG_FLAT_NODE_MEM_MAP
- NODE_DATA(nodeid)->node_mem_map =
- __alloc_bootmem_core(NODE_DATA(nodeid)->bdata,
- memmapsize, SMP_CACHE_BYTES,
- round_down(limit - memmapsize, PAGE_SIZE),
+ NODE_DATA(nodeid)->node_mem_map =
+ __alloc_bootmem_core(NODE_DATA(nodeid)->bdata,
+ memmapsize, SMP_CACHE_BYTES,
+ round_down(limit - memmapsize, PAGE_SIZE),
limit);
+}
#endif
-}

void __init numa_init_array(void)
{
@@ -570,9 +570,11 @@ void __init paging_init(void)
sparse_memory_present_with_active_regions(MAX_NUMNODES);
sparse_init();

+#ifdef CONFIG_FLAT_NODE_MEM_MAP
for_each_online_node(i) {
- setup_node_zones(i);
+ setup_node_zones(i);
}
+#endif

free_area_init_nodes(max_zone_pfns);
}
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/