Commit 90b8f3ac authored by Matthew Dobson's avatar Matthew Dobson Committed by Linus Torvalds

[PATCH] cpumask_t initializers

In the course of another patch I've been working on, I stumbled across
some weirdness with some of the SD_*_INIT sched_domains initializers.  A
day or so of digging narrowed it down to the CPU_MASK_NONE initializer
nested inside the sched_domain initializers.  The errors I got were:

kernel/sched.c:4812: error: initializer element is not constant
kernel/sched.c:4812: error: (near initialization for `sched_domain_dummy')
kernel/sched.c:4812: error: initializer element is not constant

which was this line:

static struct sched_domain sched_domain_dummy = SD_CPU_INIT;

Janis Johnson, a GCC hacker, told me the following:
parent a3192788
......@@ -234,29 +234,29 @@ static inline int __next_cpu(int n, const cpumask_t *srcp, int nbits)
#if NR_CPUS <= BITS_PER_LONG
#define CPU_MASK_ALL \
((cpumask_t) { { \
(cpumask_t) { { \
[BITS_TO_LONGS(NR_CPUS)-1] = CPU_MASK_LAST_WORD \
} })
} }
#else
#define CPU_MASK_ALL \
((cpumask_t) { { \
(cpumask_t) { { \
[0 ... BITS_TO_LONGS(NR_CPUS)-2] = ~0UL, \
[BITS_TO_LONGS(NR_CPUS)-1] = CPU_MASK_LAST_WORD \
} })
} }
#endif
#define CPU_MASK_NONE \
((cpumask_t) { { \
(cpumask_t) { { \
[0 ... BITS_TO_LONGS(NR_CPUS)-1] = 0UL \
} })
} }
#define CPU_MASK_CPU0 \
((cpumask_t) { { \
(cpumask_t) { { \
[0] = 1UL \
} })
} }
#define cpus_addr(src) ((src).bits)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment