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>
This commit is contained in:
parent
321a8e9dcb
commit
9f0e8d0400
3 changed files with 39 additions and 4 deletions
|
@ -222,8 +222,13 @@ int __next_cpu(int n, const cpumask_t *srcp);
|
|||
#define next_cpu(n, src) ({ (void)(src); 1; })
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_HAVE_CPUMASK_OF_CPU_MAP
|
||||
extern cpumask_t *cpumask_of_cpu_map;
|
||||
#define cpumask_of_cpu(cpu) (cpumask_of_cpu_map[cpu])
|
||||
|
||||
#else
|
||||
#define cpumask_of_cpu(cpu) \
|
||||
({ \
|
||||
(*({ \
|
||||
typeof(_unused_cpumask_arg_) m; \
|
||||
if (sizeof(m) == sizeof(unsigned long)) { \
|
||||
m.bits[0] = 1UL<<(cpu); \
|
||||
|
@ -231,8 +236,9 @@ int __next_cpu(int n, const cpumask_t *srcp);
|
|||
cpus_clear(m); \
|
||||
cpu_set((cpu), m); \
|
||||
} \
|
||||
m; \
|
||||
})
|
||||
&m; \
|
||||
}))
|
||||
#endif
|
||||
|
||||
#define CPU_MASK_LAST_WORD BITMAP_LAST_WORD_MASK(NR_CPUS)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue