diff options
author | Mike Travis <travis@sgi.com> | 2009-01-04 08:18:03 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2009-01-04 09:39:26 -0500 |
commit | c2d1cec1c77f7714672c1efeae075424c929e0d5 (patch) | |
tree | 94afecf37405b93b6807377e4e99cc2ac9323034 /arch/x86/include/asm/smp.h | |
parent | 588235bb53f2c215f0d4b08fd30b461fedc3338e (diff) |
x86: cleanup remaining cpumask_t ops in smpboot code
Impact: use new cpumask API to reduce memory and stack usage
Allocate the following local cpumasks based on the number of cpus that
are present. References will use new cpumask API. (Currently only
modified for x86_64, x86_32 continues to use the *_map variants.)
cpu_callin_mask
cpu_callout_mask
cpu_initialized_mask
cpu_sibling_setup_mask
Provide the following accessor functions:
struct cpumask *cpu_sibling_mask(int cpu)
struct cpumask *cpu_core_mask(int cpu)
Other changes are when setting or clearing the cpu online, possible
or present maps, use the accessor functions.
Signed-off-by: Mike Travis <travis@sgi.com>
Acked-by: Rusty Russell <rusty@rustcorp.com.au>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'arch/x86/include/asm/smp.h')
-rw-r--r-- | arch/x86/include/asm/smp.h | 32 |
1 files changed, 29 insertions, 3 deletions
diff --git a/arch/x86/include/asm/smp.h b/arch/x86/include/asm/smp.h index 830b9fcb6427..19953df61c52 100644 --- a/arch/x86/include/asm/smp.h +++ b/arch/x86/include/asm/smp.h | |||
@@ -18,9 +18,26 @@ | |||
18 | #include <asm/pda.h> | 18 | #include <asm/pda.h> |
19 | #include <asm/thread_info.h> | 19 | #include <asm/thread_info.h> |
20 | 20 | ||
21 | #ifdef CONFIG_X86_64 | ||
22 | |||
23 | extern cpumask_var_t cpu_callin_mask; | ||
24 | extern cpumask_var_t cpu_callout_mask; | ||
25 | extern cpumask_var_t cpu_initialized_mask; | ||
26 | extern cpumask_var_t cpu_sibling_setup_mask; | ||
27 | |||
28 | #else /* CONFIG_X86_32 */ | ||
29 | |||
30 | extern cpumask_t cpu_callin_map; | ||
21 | extern cpumask_t cpu_callout_map; | 31 | extern cpumask_t cpu_callout_map; |
22 | extern cpumask_t cpu_initialized; | 32 | extern cpumask_t cpu_initialized; |
23 | extern cpumask_t cpu_callin_map; | 33 | extern cpumask_t cpu_sibling_setup_map; |
34 | |||
35 | #define cpu_callin_mask ((struct cpumask *)&cpu_callin_map) | ||
36 | #define cpu_callout_mask ((struct cpumask *)&cpu_callout_map) | ||
37 | #define cpu_initialized_mask ((struct cpumask *)&cpu_initialized) | ||
38 | #define cpu_sibling_setup_mask ((struct cpumask *)&cpu_sibling_setup_map) | ||
39 | |||
40 | #endif /* CONFIG_X86_32 */ | ||
24 | 41 | ||
25 | extern void (*mtrr_hook)(void); | 42 | extern void (*mtrr_hook)(void); |
26 | extern void zap_low_mappings(void); | 43 | extern void zap_low_mappings(void); |
@@ -29,7 +46,6 @@ extern int __cpuinit get_local_pda(int cpu); | |||
29 | 46 | ||
30 | extern int smp_num_siblings; | 47 | extern int smp_num_siblings; |
31 | extern unsigned int num_processors; | 48 | extern unsigned int num_processors; |
32 | extern cpumask_t cpu_initialized; | ||
33 | 49 | ||
34 | DECLARE_PER_CPU(cpumask_t, cpu_sibling_map); | 50 | DECLARE_PER_CPU(cpumask_t, cpu_sibling_map); |
35 | DECLARE_PER_CPU(cpumask_t, cpu_core_map); | 51 | DECLARE_PER_CPU(cpumask_t, cpu_core_map); |
@@ -38,6 +54,16 @@ DECLARE_PER_CPU(u16, cpu_llc_id); | |||
38 | DECLARE_PER_CPU(int, cpu_number); | 54 | DECLARE_PER_CPU(int, cpu_number); |
39 | #endif | 55 | #endif |
40 | 56 | ||
57 | static inline struct cpumask *cpu_sibling_mask(int cpu) | ||
58 | { | ||
59 | return &per_cpu(cpu_sibling_map, cpu); | ||
60 | } | ||
61 | |||
62 | static inline struct cpumask *cpu_core_mask(int cpu) | ||
63 | { | ||
64 | return &per_cpu(cpu_core_map, cpu); | ||
65 | } | ||
66 | |||
41 | DECLARE_EARLY_PER_CPU(u16, x86_cpu_to_apicid); | 67 | DECLARE_EARLY_PER_CPU(u16, x86_cpu_to_apicid); |
42 | DECLARE_EARLY_PER_CPU(u16, x86_bios_cpu_apicid); | 68 | DECLARE_EARLY_PER_CPU(u16, x86_bios_cpu_apicid); |
43 | 69 | ||
@@ -149,7 +175,7 @@ void smp_store_cpu_info(int id); | |||
149 | /* We don't mark CPUs online until __cpu_up(), so we need another measure */ | 175 | /* We don't mark CPUs online until __cpu_up(), so we need another measure */ |
150 | static inline int num_booting_cpus(void) | 176 | static inline int num_booting_cpus(void) |
151 | { | 177 | { |
152 | return cpus_weight(cpu_callout_map); | 178 | return cpumask_weight(cpu_callout_mask); |
153 | } | 179 | } |
154 | #else | 180 | #else |
155 | static inline void prefill_possible_map(void) | 181 | static inline void prefill_possible_map(void) |