The patch titled cpu to node relationship fixup: map cpu to node has been added to the -mm tree. Its filename is cpu-to-node-relationship-fixup-map-cpu-to-node.patch See http://www.zip.com.au/~akpm/linux/patches/stuff/added-to-mm.txt to find out what to do about this ------------------------------------------------------ Subject: cpu to node relationship fixup: map cpu to node From: KAMEZAWA Hiroyuki <kamezawa.hiroyu@xxxxxxxxxxxxxx> Assume that a cpu is *physically* offlined at boot time... Because smpboot.c::smp_boot_cpu_map() canoot find cpu's sapicid, numa.c::build_cpu_to_node_map() cannot build cpu<->node map for offlined cpu. For such cpus, cpu_to_node map should be fixed at cpu-hot-add. This mapping should be done before cpu onlining. This patch also handles cpu hotremove case. Signed-off-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@xxxxxxxxxxxxxx> Cc: "Luck, Tony" <tony.luck@xxxxxxxxx> Cc: <stable@xxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxx> --- arch/ia64/kernel/numa.c | 34 +++++++++++++++++++++++++++++++--- arch/ia64/kernel/topology.c | 6 +++++- include/asm-ia64/numa.h | 4 ++++ 3 files changed, 40 insertions(+), 4 deletions(-) diff -puN arch/ia64/kernel/numa.c~cpu-to-node-relationship-fixup-map-cpu-to-node arch/ia64/kernel/numa.c --- a/arch/ia64/kernel/numa.c~cpu-to-node-relationship-fixup-map-cpu-to-node +++ a/arch/ia64/kernel/numa.c @@ -29,6 +29,36 @@ EXPORT_SYMBOL(cpu_to_node_map); cpumask_t node_to_cpu_mask[MAX_NUMNODES] __cacheline_aligned; +void __cpuinit map_cpu_to_node(int cpu, int nid) +{ + int oldnid; + if (nid < 0) { /* just initialize by zero */ + cpu_to_node_map[cpu] = 0; + return; + } + /* sanity check first */ + oldnid = cpu_to_node_map[cpu]; + if (cpu_isset(cpu, node_to_cpu_mask[oldnid])) { + return; /* nothing to do */ + } + /* we don't have cpu-driven node hot add yet... + In usual case, node is created from SRAT at boot time. */ + if (!node_online(nid)) + nid = first_online_node; + cpu_to_node_map[cpu] = nid; + cpu_set(cpu, node_to_cpu_mask[nid]); + return; +} + +void __cpuinit unmap_cpu_from_node(int cpu, int nid) +{ + WARN_ON(!cpu_isset(cpu, node_to_cpu_mask[nid])); + WARN_ON(cpu_to_node_map[cpu] != nid); + cpu_to_node_map[cpu] = 0; + cpu_clear(cpu, node_to_cpu_mask[nid]); +} + + /** * build_cpu_to_node_map - setup cpu to node and node to cpumask arrays * @@ -49,8 +79,6 @@ void __init build_cpu_to_node_map(void) node = node_cpuid[i].nid; break; } - cpu_to_node_map[cpu] = (node >= 0) ? node : 0; - if (node >= 0) - cpu_set(cpu, node_to_cpu_mask[node]); + map_cpu_to_node(cpu, node); } } diff -puN arch/ia64/kernel/topology.c~cpu-to-node-relationship-fixup-map-cpu-to-node arch/ia64/kernel/topology.c --- a/arch/ia64/kernel/topology.c~cpu-to-node-relationship-fixup-map-cpu-to-node +++ a/arch/ia64/kernel/topology.c @@ -36,6 +36,9 @@ int arch_register_cpu(int num) */ if (!can_cpei_retarget() && is_cpu_cpei_target(num)) sysfs_cpus[num].cpu.no_control = 1; +#ifdef CONFIG_NUMA + map_cpu_to_node(num, node_cpuid[num].nid); +#endif #endif return register_cpu(&sysfs_cpus[num].cpu, num); @@ -45,7 +48,8 @@ int arch_register_cpu(int num) void arch_unregister_cpu(int num) { - return unregister_cpu(&sysfs_cpus[num].cpu); + unregister_cpu(&sysfs_cpus[num].cpu); + unmap_cpu_from_node(num, cpu_to_node(num)); } EXPORT_SYMBOL(arch_register_cpu); EXPORT_SYMBOL(arch_unregister_cpu); diff -puN include/asm-ia64/numa.h~cpu-to-node-relationship-fixup-map-cpu-to-node include/asm-ia64/numa.h --- a/include/asm-ia64/numa.h~cpu-to-node-relationship-fixup-map-cpu-to-node +++ a/include/asm-ia64/numa.h @@ -64,6 +64,10 @@ extern int paddr_to_nid(unsigned long pa #define local_nodeid (cpu_to_node_map[smp_processor_id()]) +extern void map_cpu_to_node(int cpu, int nid); +extern void unmap_cpu_from_node(int cpu, int nid); + + #else /* !CONFIG_NUMA */ #define paddr_to_nid(addr) 0 _ Patches currently in -mm which might be from kamezawa.hiroyu@xxxxxxxxxxxxxx are cpu-to-node-relationship-fixup-take2.patch cpu-to-node-relationship-fixup-map-cpu-to-node.patch hot-add-mem-x86_64-fixup-externs.patch hot-add-mem-x86_64-kconfig-changes.patch hot-add-mem-x86_64-enable-sparsemem-in-sratc.patch hot-add-mem-x86_64-memory_add_physaddr_to_nid-enable.patch hot-add-mem-x86_64-memory_add_physaddr_to_nid-node-fixup.patch hot-add-mem-x86_64-memory_add_physaddr_to_nid-node-fixup-fix.patch hot-add-mem-x86_64-use-config_memory_hotplug_sparse.patch hot-add-mem-x86_64-use-config_memory_hotplug_reserve.patch hot-add-mem-x86_64-use-config_memory_hotplug_reserve-fix.patch introduce-mechanism-for-registering-active-regions-of-memory.patch have-power-use-add_active_range-and-free_area_init_nodes.patch have-x86-use-add_active_range-and-free_area_init_nodes.patch have-x86-use-add_active_range-and-free_area_init_nodes-fix.patch have-x86_64-use-add_active_range-and-free_area_init_nodes.patch have-ia64-use-add_active_range-and-free_area_init_nodes.patch account-for-memmap-and-optionally-the-kernel-image-as-holes.patch account-for-holes-that-are-outside-the-range-of-physical-memory.patch allow-an-arch-to-expand-node-boundaries.patch proc-readdir-race-fix-take-3.patch proc-readdir-race-fix-take-3-fix-1.patch proc-readdir-race-fix-take-3-fix-2.patch namespaces-utsname-sysctl-hack.patch reiser4-hardirq-include-fix.patch - To unsubscribe from this list: send the line "unsubscribe mm-commits" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html