diff options
author | Tejun Heo <tj@kernel.org> | 2011-01-23 08:37:41 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2011-01-28 08:54:10 -0500 |
commit | de2d9445f1627830ed2ebd00ee9d851986c940b5 (patch) | |
tree | f71c90737aefaca45d0e28b904c59660809ea0b3 /arch/x86/mm/numa.c | |
parent | 645a79195f66eb68ef3ab2b21d9829ac3aa085a9 (diff) |
x86: Unify node_to_cpumask_map handling between 32 and 64bit
x86_32 has been managing node_to_cpumask_map explicitly from
map_cpu_to_node() and friends in a rather ugly way. With
previous changes, it's now possible to share the code with
64bit.
* When CONFIG_NUMA_EMU is disabled, numa_add/remove_cpu() are
implemented in numa.c and shared by 32 and 64bit. CONFIG_NUMA_EMU
versions still live in numa_64.c.
NUMA_EMU's dependency on 64bit is planned to be removed and the
above should go away together.
* identify_cpu() now calls numa_add_cpu() for 32bit too. This
makes the explicit mask management from map_cpu_to_node() unnecessary.
* The whole x86_32 specific map_cpu_to_node() chunk is no longer
necessary. Dropped.
Signed-off-by: Tejun Heo <tj@kernel.org>
Reviewed-by: Pekka Enberg <penberg@kernel.org>
Cc: eric.dumazet@gmail.com
Cc: yinghai@kernel.org
Cc: brgerst@gmail.com
Cc: gorcunov@gmail.com
Cc: shaohui.zheng@intel.com
Cc: rientjes@google.com
LKML-Reference: <1295789862-25482-16-git-send-email-tj@kernel.org>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Cc: David Rientjes <rientjes@google.com>
Cc: Shaohui Zheng <shaohui.zheng@intel.com>
Diffstat (limited to 'arch/x86/mm/numa.c')
-rw-r--r-- | arch/x86/mm/numa.c | 64 |
1 files changed, 62 insertions, 2 deletions
diff --git a/arch/x86/mm/numa.c b/arch/x86/mm/numa.c index 187810be3d6c..75abecb614c9 100644 --- a/arch/x86/mm/numa.c +++ b/arch/x86/mm/numa.c | |||
@@ -99,7 +99,21 @@ void __init setup_node_to_cpumask_map(void) | |||
99 | pr_debug("Node to cpumask map for %d nodes\n", nr_node_ids); | 99 | pr_debug("Node to cpumask map for %d nodes\n", nr_node_ids); |
100 | } | 100 | } |
101 | 101 | ||
102 | #ifdef CONFIG_DEBUG_PER_CPU_MAPS | 102 | #ifndef CONFIG_DEBUG_PER_CPU_MAPS |
103 | |||
104 | # ifndef CONFIG_NUMA_EMU | ||
105 | void __cpuinit numa_add_cpu(int cpu) | ||
106 | { | ||
107 | cpumask_set_cpu(cpu, node_to_cpumask_map[early_cpu_to_node(cpu)]); | ||
108 | } | ||
109 | |||
110 | void __cpuinit numa_remove_cpu(int cpu) | ||
111 | { | ||
112 | cpumask_clear_cpu(cpu, node_to_cpumask_map[early_cpu_to_node(cpu)]); | ||
113 | } | ||
114 | # endif /* !CONFIG_NUMA_EMU */ | ||
115 | |||
116 | #else /* !CONFIG_DEBUG_PER_CPU_MAPS */ | ||
103 | 117 | ||
104 | int __cpu_to_node(int cpu) | 118 | int __cpu_to_node(int cpu) |
105 | { | 119 | { |
@@ -131,6 +145,52 @@ int early_cpu_to_node(int cpu) | |||
131 | return per_cpu(x86_cpu_to_node_map, cpu); | 145 | return per_cpu(x86_cpu_to_node_map, cpu); |
132 | } | 146 | } |
133 | 147 | ||
148 | struct cpumask __cpuinit *debug_cpumask_set_cpu(int cpu, int enable) | ||
149 | { | ||
150 | int node = early_cpu_to_node(cpu); | ||
151 | struct cpumask *mask; | ||
152 | char buf[64]; | ||
153 | |||
154 | mask = node_to_cpumask_map[node]; | ||
155 | if (!mask) { | ||
156 | pr_err("node_to_cpumask_map[%i] NULL\n", node); | ||
157 | dump_stack(); | ||
158 | return NULL; | ||
159 | } | ||
160 | |||
161 | cpulist_scnprintf(buf, sizeof(buf), mask); | ||
162 | printk(KERN_DEBUG "%s cpu %d node %d: mask now %s\n", | ||
163 | enable ? "numa_add_cpu" : "numa_remove_cpu", | ||
164 | cpu, node, buf); | ||
165 | return mask; | ||
166 | } | ||
167 | |||
168 | # ifndef CONFIG_NUMA_EMU | ||
169 | static void __cpuinit numa_set_cpumask(int cpu, int enable) | ||
170 | { | ||
171 | struct cpumask *mask; | ||
172 | |||
173 | mask = debug_cpumask_set_cpu(cpu, enable); | ||
174 | if (!mask) | ||
175 | return; | ||
176 | |||
177 | if (enable) | ||
178 | cpumask_set_cpu(cpu, mask); | ||
179 | else | ||
180 | cpumask_clear_cpu(cpu, mask); | ||
181 | } | ||
182 | |||
183 | void __cpuinit numa_add_cpu(int cpu) | ||
184 | { | ||
185 | numa_set_cpumask(cpu, 1); | ||
186 | } | ||
187 | |||
188 | void __cpuinit numa_remove_cpu(int cpu) | ||
189 | { | ||
190 | numa_set_cpumask(cpu, 0); | ||
191 | } | ||
192 | # endif /* !CONFIG_NUMA_EMU */ | ||
193 | |||
134 | /* | 194 | /* |
135 | * Returns a pointer to the bitmask of CPUs on Node 'node'. | 195 | * Returns a pointer to the bitmask of CPUs on Node 'node'. |
136 | */ | 196 | */ |
@@ -154,4 +214,4 @@ const struct cpumask *cpumask_of_node(int node) | |||
154 | } | 214 | } |
155 | EXPORT_SYMBOL(cpumask_of_node); | 215 | EXPORT_SYMBOL(cpumask_of_node); |
156 | 216 | ||
157 | #endif /* CONFIG_DEBUG_PER_CPU_MAPS */ | 217 | #endif /* !CONFIG_DEBUG_PER_CPU_MAPS */ |