diff options
Diffstat (limited to 'arch/ia64')
-rw-r--r-- | arch/ia64/kernel/numa.c | 34 | ||||
-rw-r--r-- | arch/ia64/kernel/topology.c | 6 |
2 files changed, 36 insertions, 4 deletions
diff --git a/arch/ia64/kernel/numa.c b/arch/ia64/kernel/numa.c index 1cc360c83e7a..20340631179f 100644 --- a/arch/ia64/kernel/numa.c +++ b/arch/ia64/kernel/numa.c | |||
@@ -29,6 +29,36 @@ EXPORT_SYMBOL(cpu_to_node_map); | |||
29 | 29 | ||
30 | cpumask_t node_to_cpu_mask[MAX_NUMNODES] __cacheline_aligned; | 30 | cpumask_t node_to_cpu_mask[MAX_NUMNODES] __cacheline_aligned; |
31 | 31 | ||
32 | void __cpuinit map_cpu_to_node(int cpu, int nid) | ||
33 | { | ||
34 | int oldnid; | ||
35 | if (nid < 0) { /* just initialize by zero */ | ||
36 | cpu_to_node_map[cpu] = 0; | ||
37 | return; | ||
38 | } | ||
39 | /* sanity check first */ | ||
40 | oldnid = cpu_to_node_map[cpu]; | ||
41 | if (cpu_isset(cpu, node_to_cpu_mask[oldnid])) { | ||
42 | return; /* nothing to do */ | ||
43 | } | ||
44 | /* we don't have cpu-driven node hot add yet... | ||
45 | In usual case, node is created from SRAT at boot time. */ | ||
46 | if (!node_online(nid)) | ||
47 | nid = first_online_node; | ||
48 | cpu_to_node_map[cpu] = nid; | ||
49 | cpu_set(cpu, node_to_cpu_mask[nid]); | ||
50 | return; | ||
51 | } | ||
52 | |||
53 | void __cpuinit unmap_cpu_from_node(int cpu, int nid) | ||
54 | { | ||
55 | WARN_ON(!cpu_isset(cpu, node_to_cpu_mask[nid])); | ||
56 | WARN_ON(cpu_to_node_map[cpu] != nid); | ||
57 | cpu_to_node_map[cpu] = 0; | ||
58 | cpu_clear(cpu, node_to_cpu_mask[nid]); | ||
59 | } | ||
60 | |||
61 | |||
32 | /** | 62 | /** |
33 | * build_cpu_to_node_map - setup cpu to node and node to cpumask arrays | 63 | * build_cpu_to_node_map - setup cpu to node and node to cpumask arrays |
34 | * | 64 | * |
@@ -49,8 +79,6 @@ void __init build_cpu_to_node_map(void) | |||
49 | node = node_cpuid[i].nid; | 79 | node = node_cpuid[i].nid; |
50 | break; | 80 | break; |
51 | } | 81 | } |
52 | cpu_to_node_map[cpu] = (node >= 0) ? node : 0; | 82 | map_cpu_to_node(cpu, node); |
53 | if (node >= 0) | ||
54 | cpu_set(cpu, node_to_cpu_mask[node]); | ||
55 | } | 83 | } |
56 | } | 84 | } |
diff --git a/arch/ia64/kernel/topology.c b/arch/ia64/kernel/topology.c index f648c610b10c..05bdf7affb43 100644 --- a/arch/ia64/kernel/topology.c +++ b/arch/ia64/kernel/topology.c | |||
@@ -36,6 +36,9 @@ int arch_register_cpu(int num) | |||
36 | */ | 36 | */ |
37 | if (!can_cpei_retarget() && is_cpu_cpei_target(num)) | 37 | if (!can_cpei_retarget() && is_cpu_cpei_target(num)) |
38 | sysfs_cpus[num].cpu.no_control = 1; | 38 | sysfs_cpus[num].cpu.no_control = 1; |
39 | #ifdef CONFIG_NUMA | ||
40 | map_cpu_to_node(num, node_cpuid[num].nid); | ||
41 | #endif | ||
39 | #endif | 42 | #endif |
40 | 43 | ||
41 | return register_cpu(&sysfs_cpus[num].cpu, num); | 44 | return register_cpu(&sysfs_cpus[num].cpu, num); |
@@ -45,7 +48,8 @@ int arch_register_cpu(int num) | |||
45 | 48 | ||
46 | void arch_unregister_cpu(int num) | 49 | void arch_unregister_cpu(int num) |
47 | { | 50 | { |
48 | return unregister_cpu(&sysfs_cpus[num].cpu); | 51 | unregister_cpu(&sysfs_cpus[num].cpu); |
52 | unmap_cpu_from_node(num, cpu_to_node(num)); | ||
49 | } | 53 | } |
50 | EXPORT_SYMBOL(arch_register_cpu); | 54 | EXPORT_SYMBOL(arch_register_cpu); |
51 | EXPORT_SYMBOL(arch_unregister_cpu); | 55 | EXPORT_SYMBOL(arch_unregister_cpu); |