diff options
author | Mike Travis <travis@sgi.com> | 2007-10-16 04:24:05 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-10-16 12:42:50 -0400 |
commit | d5a7430ddcdb598261d70f7eb1bf450b5be52085 (patch) | |
tree | 3b94672e0dbc2bff125de3266908f1a47a17b795 /arch/x86/kernel/smpboot_64.c | |
parent | 083576112940fda783d716fd5ccc744f81667b2f (diff) |
Convert cpu_sibling_map to be a per cpu variable
Convert cpu_sibling_map from a static array sized by NR_CPUS to a per_cpu
variable. This saves sizeof(cpumask_t) * NR unused cpus. Access is mostly
from startup and CPU HOTPLUG functions.
Signed-off-by: Mike Travis <travis@sgi.com>
Cc: Andi Kleen <ak@suse.de>
Cc: Christoph Lameter <clameter@sgi.com>
Cc: "Siddha, Suresh B" <suresh.b.siddha@intel.com>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: "Luck, Tony" <tony.luck@intel.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'arch/x86/kernel/smpboot_64.c')
-rw-r--r-- | arch/x86/kernel/smpboot_64.c | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/arch/x86/kernel/smpboot_64.c b/arch/x86/kernel/smpboot_64.c index 6723c8622828..0faa0a0af272 100644 --- a/arch/x86/kernel/smpboot_64.c +++ b/arch/x86/kernel/smpboot_64.c | |||
@@ -91,8 +91,8 @@ EXPORT_SYMBOL(cpu_data); | |||
91 | int smp_threads_ready; | 91 | int smp_threads_ready; |
92 | 92 | ||
93 | /* representing HT siblings of each logical CPU */ | 93 | /* representing HT siblings of each logical CPU */ |
94 | cpumask_t cpu_sibling_map[NR_CPUS] __read_mostly; | 94 | DEFINE_PER_CPU(cpumask_t, cpu_sibling_map); |
95 | EXPORT_SYMBOL(cpu_sibling_map); | 95 | EXPORT_PER_CPU_SYMBOL(cpu_sibling_map); |
96 | 96 | ||
97 | /* representing HT and core siblings of each logical CPU */ | 97 | /* representing HT and core siblings of each logical CPU */ |
98 | DEFINE_PER_CPU(cpumask_t, cpu_core_map); | 98 | DEFINE_PER_CPU(cpumask_t, cpu_core_map); |
@@ -262,8 +262,8 @@ static inline void set_cpu_sibling_map(int cpu) | |||
262 | for_each_cpu_mask(i, cpu_sibling_setup_map) { | 262 | for_each_cpu_mask(i, cpu_sibling_setup_map) { |
263 | if (c[cpu].phys_proc_id == c[i].phys_proc_id && | 263 | if (c[cpu].phys_proc_id == c[i].phys_proc_id && |
264 | c[cpu].cpu_core_id == c[i].cpu_core_id) { | 264 | c[cpu].cpu_core_id == c[i].cpu_core_id) { |
265 | cpu_set(i, cpu_sibling_map[cpu]); | 265 | cpu_set(i, per_cpu(cpu_sibling_map, cpu)); |
266 | cpu_set(cpu, cpu_sibling_map[i]); | 266 | cpu_set(cpu, per_cpu(cpu_sibling_map, i)); |
267 | cpu_set(i, per_cpu(cpu_core_map, cpu)); | 267 | cpu_set(i, per_cpu(cpu_core_map, cpu)); |
268 | cpu_set(cpu, per_cpu(cpu_core_map, i)); | 268 | cpu_set(cpu, per_cpu(cpu_core_map, i)); |
269 | cpu_set(i, c[cpu].llc_shared_map); | 269 | cpu_set(i, c[cpu].llc_shared_map); |
@@ -271,13 +271,13 @@ static inline void set_cpu_sibling_map(int cpu) | |||
271 | } | 271 | } |
272 | } | 272 | } |
273 | } else { | 273 | } else { |
274 | cpu_set(cpu, cpu_sibling_map[cpu]); | 274 | cpu_set(cpu, per_cpu(cpu_sibling_map, cpu)); |
275 | } | 275 | } |
276 | 276 | ||
277 | cpu_set(cpu, c[cpu].llc_shared_map); | 277 | cpu_set(cpu, c[cpu].llc_shared_map); |
278 | 278 | ||
279 | if (current_cpu_data.x86_max_cores == 1) { | 279 | if (current_cpu_data.x86_max_cores == 1) { |
280 | per_cpu(cpu_core_map, cpu) = cpu_sibling_map[cpu]; | 280 | per_cpu(cpu_core_map, cpu) = per_cpu(cpu_sibling_map, cpu); |
281 | c[cpu].booted_cores = 1; | 281 | c[cpu].booted_cores = 1; |
282 | return; | 282 | return; |
283 | } | 283 | } |
@@ -294,12 +294,12 @@ static inline void set_cpu_sibling_map(int cpu) | |||
294 | /* | 294 | /* |
295 | * Does this new cpu bringup a new core? | 295 | * Does this new cpu bringup a new core? |
296 | */ | 296 | */ |
297 | if (cpus_weight(cpu_sibling_map[cpu]) == 1) { | 297 | if (cpus_weight(per_cpu(cpu_sibling_map, cpu)) == 1) { |
298 | /* | 298 | /* |
299 | * for each core in package, increment | 299 | * for each core in package, increment |
300 | * the booted_cores for this new cpu | 300 | * the booted_cores for this new cpu |
301 | */ | 301 | */ |
302 | if (first_cpu(cpu_sibling_map[i]) == i) | 302 | if (first_cpu(per_cpu(cpu_sibling_map, i)) == i) |
303 | c[cpu].booted_cores++; | 303 | c[cpu].booted_cores++; |
304 | /* | 304 | /* |
305 | * increment the core count for all | 305 | * increment the core count for all |
@@ -735,7 +735,7 @@ static __init void disable_smp(void) | |||
735 | phys_cpu_present_map = physid_mask_of_physid(boot_cpu_id); | 735 | phys_cpu_present_map = physid_mask_of_physid(boot_cpu_id); |
736 | else | 736 | else |
737 | phys_cpu_present_map = physid_mask_of_physid(0); | 737 | phys_cpu_present_map = physid_mask_of_physid(0); |
738 | cpu_set(0, cpu_sibling_map[0]); | 738 | cpu_set(0, per_cpu(cpu_sibling_map, 0)); |
739 | cpu_set(0, per_cpu(cpu_core_map, 0)); | 739 | cpu_set(0, per_cpu(cpu_core_map, 0)); |
740 | } | 740 | } |
741 | 741 | ||
@@ -976,13 +976,13 @@ static void remove_siblinginfo(int cpu) | |||
976 | /* | 976 | /* |
977 | * last thread sibling in this cpu core going down | 977 | * last thread sibling in this cpu core going down |
978 | */ | 978 | */ |
979 | if (cpus_weight(cpu_sibling_map[cpu]) == 1) | 979 | if (cpus_weight(per_cpu(cpu_sibling_map, cpu)) == 1) |
980 | c[sibling].booted_cores--; | 980 | c[sibling].booted_cores--; |
981 | } | 981 | } |
982 | 982 | ||
983 | for_each_cpu_mask(sibling, cpu_sibling_map[cpu]) | 983 | for_each_cpu_mask(sibling, per_cpu(cpu_sibling_map, cpu)) |
984 | cpu_clear(cpu, cpu_sibling_map[sibling]); | 984 | cpu_clear(cpu, per_cpu(cpu_sibling_map, sibling)); |
985 | cpus_clear(cpu_sibling_map[cpu]); | 985 | cpus_clear(per_cpu(cpu_sibling_map, cpu)); |
986 | cpus_clear(per_cpu(cpu_core_map, cpu)); | 986 | cpus_clear(per_cpu(cpu_core_map, cpu)); |
987 | c[cpu].phys_proc_id = 0; | 987 | c[cpu].phys_proc_id = 0; |
988 | c[cpu].cpu_core_id = 0; | 988 | c[cpu].cpu_core_id = 0; |