From: Rusty Russell From: colpatch@us.ibm.com The cpu_2_node[] array for i386 is initialized to all 0's, meaning that until modified at CPU bring-up, all CPUs are mapped to node 0. When CPUs are brought online, they are mapped to the appropriate node by various mechanisms, depending on the underlying hardware. When we unmap CPUs (hotplug time), we should return the mapping for the CPU that is going away to its original state, ie: 0. When this code was initially submitted, the misguided poster (me) made the mistake of putting a -1 in the cpu_2_node[] array for the CPU going away. This patch fixes this mistake, and allows code to get a valid node number for all valid CPU numbers. This is important, because most (if not all) callers do not error check the value returned by the cpu_to_node() macro, and they should not have to. The API specifies that a valid node number be returned for any valid CPU number. --- 25-akpm/arch/i386/kernel/smpboot.c | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) diff -puN arch/i386/kernel/smpboot.c~unmapped-CPU-node-number-fix arch/i386/kernel/smpboot.c --- 25/arch/i386/kernel/smpboot.c~unmapped-CPU-node-number-fix 2004-04-03 03:00:02.643829632 -0800 +++ 25-akpm/arch/i386/kernel/smpboot.c 2004-04-03 03:00:02.647829024 -0800 @@ -522,7 +522,7 @@ static inline void unmap_cpu_to_node(int printk("Unmapping cpu %d from all nodes\n", cpu); for (node = 0; node < MAX_NUMNODES; node ++) cpu_clear(cpu, node_2_cpu_mask[node]); - cpu_2_node[cpu] = -1; + cpu_2_node[cpu] = 0; } #else /* !CONFIG_NUMA */ _