Commit 390b9111 authored by Andi Kleen's avatar Andi Kleen Committed by Linus Torvalds

[PATCH] x86_64: Fix some outdated assumptions that CPU numbers are equal numbers.

Fix some outdated assumptions that CPU numbers are equal numbers.

Depends on the unlimited cpus patch.
Signed-off-by: default avatarAndi Kleen <ak@suse.de>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 6c2cc2fd
...@@ -83,13 +83,12 @@ void __init setup_per_cpu_areas(void) ...@@ -83,13 +83,12 @@ void __init setup_per_cpu_areas(void)
for (i = 0; i < NR_CPUS; i++) { for (i = 0; i < NR_CPUS; i++) {
unsigned char *ptr; unsigned char *ptr;
/* If possible allocate on the node of the CPU.
In case it doesn't exist round-robin nodes. */ if (!NODE_DATA(cpu_to_node(i))) {
if (!NODE_DATA(i % numnodes)) {
printk("cpu with no node %d, numnodes %d\n", i, numnodes); printk("cpu with no node %d, numnodes %d\n", i, numnodes);
ptr = alloc_bootmem(size); ptr = alloc_bootmem(size);
} else { } else {
ptr = alloc_bootmem_node(NODE_DATA(i % numnodes), size); ptr = alloc_bootmem_node(NODE_DATA(cpu_to_node(i)), size);
} }
if (!ptr) if (!ptr)
panic("Cannot allocate cpu data for CPU %d\n", i); panic("Cannot allocate cpu data for CPU %d\n", i);
......
...@@ -152,15 +152,12 @@ void __init numa_init_array(void) ...@@ -152,15 +152,12 @@ void __init numa_init_array(void)
CPUs, as the number of CPUs is not known yet. CPUs, as the number of CPUs is not known yet.
We round robin the existing nodes. */ We round robin the existing nodes. */
rr = 0; rr = 0;
for (i = 0; i < MAX_NUMNODES; i++) { for (i = 0; i < NR_CPUS; i++) {
if (node_online(i))
continue;
if (cpu_to_node[i] != NUMA_NO_NODE) if (cpu_to_node[i] != NUMA_NO_NODE)
continue; continue;
rr = next_node(rr, node_online_map); rr = next_node(rr, node_online_map);
if (rr == MAX_NUMNODES) if (rr == MAX_NUMNODES)
rr = first_node(node_online_map); rr = first_node(node_online_map);
node_data[i] = node_data[rr];
cpu_to_node[i] = rr; cpu_to_node[i] = rr;
rr++; rr++;
} }
......
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