diff options
author | Mike Travis <travis@sgi.com> | 2008-04-04 21:11:01 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-04-19 13:44:59 -0400 |
commit | 9f0e8d0400d925c3acd5f4e01dbeb736e4011882 (patch) | |
tree | 970dab54eeba019e4649aa32730489206be5f8a2 /include/linux/cpumask.h | |
parent | 321a8e9dcb714f3c350ba55e41ed447bf3f05fac (diff) |
x86: convert cpumask_of_cpu macro to allocated array
* Here is a simple patch to use an allocated array of cpumasks to
represent cpumask_of_cpu() instead of constructing one on the stack.
It's based on the Kconfig option "HAVE_CPUMASK_OF_CPU_MAP" which is
currently only set for x86_64 SMP. Otherwise the the existing
cpumask_of_cpu() is used but has been changed to produce an lvalue
so a pointer to it can be used.
Cc: H. Peter Anvin <hpa@zytor.com>
Signed-off-by: Christoph Lameter <clameter@sgi.com>
Signed-off-by: Mike Travis <travis@sgi.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'include/linux/cpumask.h')
-rw-r--r-- | include/linux/cpumask.h | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/include/linux/cpumask.h b/include/linux/cpumask.h index 629102feaa66..259c8051155d 100644 --- a/include/linux/cpumask.h +++ b/include/linux/cpumask.h | |||
@@ -222,8 +222,13 @@ int __next_cpu(int n, const cpumask_t *srcp); | |||
222 | #define next_cpu(n, src) ({ (void)(src); 1; }) | 222 | #define next_cpu(n, src) ({ (void)(src); 1; }) |
223 | #endif | 223 | #endif |
224 | 224 | ||
225 | #ifdef CONFIG_HAVE_CPUMASK_OF_CPU_MAP | ||
226 | extern cpumask_t *cpumask_of_cpu_map; | ||
227 | #define cpumask_of_cpu(cpu) (cpumask_of_cpu_map[cpu]) | ||
228 | |||
229 | #else | ||
225 | #define cpumask_of_cpu(cpu) \ | 230 | #define cpumask_of_cpu(cpu) \ |
226 | ({ \ | 231 | (*({ \ |
227 | typeof(_unused_cpumask_arg_) m; \ | 232 | typeof(_unused_cpumask_arg_) m; \ |
228 | if (sizeof(m) == sizeof(unsigned long)) { \ | 233 | if (sizeof(m) == sizeof(unsigned long)) { \ |
229 | m.bits[0] = 1UL<<(cpu); \ | 234 | m.bits[0] = 1UL<<(cpu); \ |
@@ -231,8 +236,9 @@ int __next_cpu(int n, const cpumask_t *srcp); | |||
231 | cpus_clear(m); \ | 236 | cpus_clear(m); \ |
232 | cpu_set((cpu), m); \ | 237 | cpu_set((cpu), m); \ |
233 | } \ | 238 | } \ |
234 | m; \ | 239 | &m; \ |
235 | }) | 240 | })) |
241 | #endif | ||
236 | 242 | ||
237 | #define CPU_MASK_LAST_WORD BITMAP_LAST_WORD_MASK(NR_CPUS) | 243 | #define CPU_MASK_LAST_WORD BITMAP_LAST_WORD_MASK(NR_CPUS) |
238 | 244 | ||