Commit b9462e80 authored by Matthew Dobson's avatar Matthew Dobson Committed by Linus Torvalds

[PATCH] Replace 'numnodes' with 'node_online_map' - arm

Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 0c33aaa4
...@@ -55,7 +55,7 @@ void show_mem(void) ...@@ -55,7 +55,7 @@ void show_mem(void)
show_free_areas(); show_free_areas();
printk("Free swap: %6ldkB\n", nr_swap_pages<<(PAGE_SHIFT-10)); 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; struct page *page, *end;
page = NODE_MEM_MAP(node); page = NODE_MEM_MAP(node);
...@@ -178,18 +178,14 @@ find_memend_and_nodes(struct meminfo *mi, struct node_info *np) ...@@ -178,18 +178,14 @@ find_memend_and_nodes(struct meminfo *mi, struct node_info *np)
node = mi->bank[i].node; node = mi->bank[i].node;
if (node >= numnodes) {
numnodes = node + 1;
/* /*
* Make sure we haven't exceeded the maximum number * Make sure we haven't exceeded the maximum number of nodes
* of nodes that we have in this configuration. If * that we have in this configuration. If we have, we're in
* we have, we're in trouble. (maybe we ought to * trouble. (maybe we ought to limit, instead of bugging?)
* limit, instead of bugging?)
*/ */
if (numnodes > MAX_NUMNODES) if (node >= MAX_NUMNODES)
BUG(); BUG();
} node_set_online(node);
/* /*
* Get the start and end pfns for this bank * Get the start and end pfns for this bank
...@@ -211,7 +207,7 @@ find_memend_and_nodes(struct meminfo *mi, struct node_info *np) ...@@ -211,7 +207,7 @@ find_memend_and_nodes(struct meminfo *mi, struct node_info *np)
* Calculate the number of pages we require to * Calculate the number of pages we require to
* store the bootmem bitmaps. * store the bootmem bitmaps.
*/ */
for (i = 0; i < numnodes; i++) { for_each_online_node(i) {
if (np[i].end == 0) if (np[i].end == 0)
continue; continue;
...@@ -380,13 +376,13 @@ static void __init bootmem_init(struct meminfo *mi) ...@@ -380,13 +376,13 @@ static void __init bootmem_init(struct meminfo *mi)
* (we could also do with rolling bootmem_init and paging_init * (we could also do with rolling bootmem_init and paging_init
* into one generic "memory_init" type function). * into one generic "memory_init" type function).
*/ */
np += numnodes - 1; np += num_online_nodes() - 1;
for (node = numnodes - 1; node >= 0; node--, np--) { for (node = num_online_nodes() - 1; node >= 0; node--, np--) {
/* /*
* If there are no pages in this node, ignore it. * If there are no pages in this node, ignore it.
* Note that node 0 must always have some pages. * Note that node 0 must always have some pages.
*/ */
if (np->end == 0) { if (np->end == 0 || !node_online(node)) {
if (node == 0) if (node == 0)
BUG(); BUG();
continue; continue;
...@@ -449,7 +445,7 @@ void __init paging_init(struct meminfo *mi, struct machine_desc *mdesc) ...@@ -449,7 +445,7 @@ void __init paging_init(struct meminfo *mi, struct machine_desc *mdesc)
/* /*
* initialise the zones within each node * 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 zone_size[MAX_NR_ZONES];
unsigned long zhole_size[MAX_NR_ZONES]; unsigned long zhole_size[MAX_NR_ZONES];
struct bootmem_data *bdata; struct bootmem_data *bdata;
...@@ -558,7 +554,7 @@ void __init mem_init(void) ...@@ -558,7 +554,7 @@ void __init mem_init(void)
create_memmap_holes(&meminfo); create_memmap_holes(&meminfo);
/* this will put all unused low memory onto the freelists */ /* 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); pg_data_t *pgdat = NODE_DATA(node);
if (pgdat->node_spanned_pages != 0) if (pgdat->node_spanned_pages != 0)
......
...@@ -701,6 +701,6 @@ void __init create_memmap_holes(struct meminfo *mi) ...@@ -701,6 +701,6 @@ void __init create_memmap_holes(struct meminfo *mi)
{ {
int node; int node;
for (node = 0; node < numnodes; node++) for_each_online_node(node)
free_unused_memmap_node(node, mi); free_unused_memmap_node(node, mi);
} }
...@@ -155,7 +155,8 @@ find_memend_and_nodes(struct meminfo *mi, struct node_info *np) ...@@ -155,7 +155,8 @@ find_memend_and_nodes(struct meminfo *mi, struct node_info *np)
{ {
unsigned int memend_pfn = 0; unsigned int memend_pfn = 0;
numnodes = 1; nodes_clear(node_online_map);
node_set_online(0);
np->bootmap_pages = 0; np->bootmap_pages = 0;
......
...@@ -37,8 +37,6 @@ ...@@ -37,8 +37,6 @@
* node 3: 0xac000000-0xafffffff --> 0xcc000000-0xcfffffff * node 3: 0xac000000-0xafffffff --> 0xcc000000-0xcfffffff
*/ */
#define NR_NODES 4
/* /*
* Given a kernel address, find the home node of the underlying memory. * Given a kernel address, find the home node of the underlying memory.
*/ */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment