From: Matthew Dobson 2/10 - Replace numnodes with node_online_map for arm [mcd@arrakis node_online_map]$ diffstat arch-arm.patch -Matt Signed-off-by: Andrew Morton --- 25-akpm/arch/arm/mm/init.c | 34 +++++++++++++----------------- 25-akpm/arch/arm/mm/mm-armv.c | 2 - 25-akpm/arch/arm26/mm/init.c | 3 +- 25-akpm/include/asm-arm/arch-pxa/memory.h | 2 - 4 files changed, 18 insertions(+), 23 deletions(-) diff -puN arch/arm26/mm/init.c~replace-numnodes-with-node_online_map-arm arch/arm26/mm/init.c --- 25/arch/arm26/mm/init.c~replace-numnodes-with-node_online_map-arm Thu Dec 23 15:21:54 2004 +++ 25-akpm/arch/arm26/mm/init.c Thu Dec 23 15:21:54 2004 @@ -155,7 +155,8 @@ find_memend_and_nodes(struct meminfo *mi { unsigned int memend_pfn = 0; - numnodes = 1; + nodes_clear(node_online_map); + node_set_online(0); np->bootmap_pages = 0; diff -puN arch/arm/mm/init.c~replace-numnodes-with-node_online_map-arm arch/arm/mm/init.c --- 25/arch/arm/mm/init.c~replace-numnodes-with-node_online_map-arm Thu Dec 23 15:21:54 2004 +++ 25-akpm/arch/arm/mm/init.c Thu Dec 23 15:21:54 2004 @@ -55,7 +55,7 @@ void show_mem(void) show_free_areas(); printk("Free swap: %6ldkB\n", nr_swap_pages<<(PAGE_SHIFT-10)); - for (node = 0; node < numnodes; node++) { + for_each_online_node(node) { struct page *page, *end; page = NODE_MEM_MAP(node); @@ -178,18 +178,14 @@ find_memend_and_nodes(struct meminfo *mi node = mi->bank[i].node; - if (node >= numnodes) { - numnodes = node + 1; - - /* - * Make sure we haven't exceeded the maximum number - * of nodes that we have in this configuration. If - * we have, we're in trouble. (maybe we ought to - * limit, instead of bugging?) - */ - if (numnodes > MAX_NUMNODES) - BUG(); - } + /* + * Make sure we haven't exceeded the maximum number of nodes + * that we have in this configuration. If we have, we're in + * trouble. (maybe we ought to limit, instead of bugging?) + */ + if (node >= MAX_NUMNODES) + BUG(); + node_set_online(node); /* * Get the start and end pfns for this bank @@ -211,7 +207,7 @@ find_memend_and_nodes(struct meminfo *mi * Calculate the number of pages we require to * store the bootmem bitmaps. */ - for (i = 0; i < numnodes; i++) { + for_each_online_node(i) { if (np[i].end == 0) continue; @@ -380,13 +376,13 @@ static void __init bootmem_init(struct m * (we could also do with rolling bootmem_init and paging_init * into one generic "memory_init" type function). */ - np += numnodes - 1; - for (node = numnodes - 1; node >= 0; node--, np--) { + np += num_online_nodes() - 1; + for (node = num_online_nodes() - 1; node >= 0; node--, np--) { /* * If there are no pages in this node, ignore it. * Note that node 0 must always have some pages. */ - if (np->end == 0) { + if (np->end == 0 || !node_online(node)) { if (node == 0) BUG(); continue; @@ -449,7 +445,7 @@ void __init paging_init(struct meminfo * /* * initialise the zones within each node */ - for (node = 0; node < numnodes; node++) { + for_each_online_node(node) { unsigned long zone_size[MAX_NR_ZONES]; unsigned long zhole_size[MAX_NR_ZONES]; struct bootmem_data *bdata; @@ -558,7 +554,7 @@ void __init mem_init(void) create_memmap_holes(&meminfo); /* this will put all unused low memory onto the freelists */ - for (node = 0; node < numnodes; node++) { + for_each_online_node(node) { pg_data_t *pgdat = NODE_DATA(node); if (pgdat->node_spanned_pages != 0) diff -puN arch/arm/mm/mm-armv.c~replace-numnodes-with-node_online_map-arm arch/arm/mm/mm-armv.c --- 25/arch/arm/mm/mm-armv.c~replace-numnodes-with-node_online_map-arm Thu Dec 23 15:21:54 2004 +++ 25-akpm/arch/arm/mm/mm-armv.c Thu Dec 23 15:21:54 2004 @@ -697,6 +697,6 @@ void __init create_memmap_holes(struct m { int node; - for (node = 0; node < numnodes; node++) + for_each_online_node(node) free_unused_memmap_node(node, mi); } diff -puN include/asm-arm/arch-pxa/memory.h~replace-numnodes-with-node_online_map-arm include/asm-arm/arch-pxa/memory.h --- 25/include/asm-arm/arch-pxa/memory.h~replace-numnodes-with-node_online_map-arm Thu Dec 23 15:21:54 2004 +++ 25-akpm/include/asm-arm/arch-pxa/memory.h Thu Dec 23 15:21:54 2004 @@ -37,8 +37,6 @@ * node 3: 0xac000000-0xafffffff --> 0xcc000000-0xcfffffff */ -#define NR_NODES 4 - /* * Given a kernel address, find the home node of the underlying memory. */ _