diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2009-01-03 15:04:39 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-01-03 15:04:39 -0500 |
commit | 7d3b56ba37a95f1f370f50258ed3954c304c524b (patch) | |
tree | 86102527b92f02450aa245f084ffb491c18d2e0a /include | |
parent | 269b012321f2f1f8e4648c43a93bf432b42c6668 (diff) | |
parent | ab14398abd195af91a744c320a52a1bce814dd1e (diff) |
Merge branch 'cpus4096-for-linus-3' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip
* 'cpus4096-for-linus-3' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip: (77 commits)
x86: setup_per_cpu_areas() cleanup
cpumask: fix compile error when CONFIG_NR_CPUS is not defined
cpumask: use alloc_cpumask_var_node where appropriate
cpumask: convert shared_cpu_map in acpi_processor* structs to cpumask_var_t
x86: use cpumask_var_t in acpi/boot.c
x86: cleanup some remaining usages of NR_CPUS where s/b nr_cpu_ids
sched: put back some stack hog changes that were undone in kernel/sched.c
x86: enable cpus display of kernel_max and offlined cpus
ia64: cpumask fix for is_affinity_mask_valid()
cpumask: convert RCU implementations, fix
xtensa: define __fls
mn10300: define __fls
m32r: define __fls
h8300: define __fls
frv: define __fls
cris: define __fls
cpumask: CONFIG_DISABLE_OBSOLETE_CPUMASK_FUNCTIONS
cpumask: zero extra bits in alloc_cpumask_var_node
cpumask: replace for_each_cpu_mask_nr with for_each_cpu in kernel/time/
cpumask: convert mm/
...
Diffstat (limited to 'include')
-rw-r--r-- | include/acpi/processor.h | 4 | ||||
-rw-r--r-- | include/asm-frv/bitops.h | 13 | ||||
-rw-r--r-- | include/asm-m32r/bitops.h | 1 | ||||
-rw-r--r-- | include/asm-m68k/bitops.h | 5 | ||||
-rw-r--r-- | include/asm-mn10300/bitops.h | 11 | ||||
-rw-r--r-- | include/asm-xtensa/bitops.h | 11 | ||||
-rw-r--r-- | include/linux/bitmap.h | 35 | ||||
-rw-r--r-- | include/linux/bitops.h | 13 | ||||
-rw-r--r-- | include/linux/cpumask.h | 221 | ||||
-rw-r--r-- | include/linux/interrupt.h | 2 | ||||
-rw-r--r-- | include/linux/rcuclassic.h | 4 | ||||
-rw-r--r-- | include/linux/seq_file.h | 7 | ||||
-rw-r--r-- | include/linux/smp.h | 18 | ||||
-rw-r--r-- | include/linux/stop_machine.h | 6 | ||||
-rw-r--r-- | include/linux/threads.h | 16 | ||||
-rw-r--r-- | include/linux/tick.h | 4 |
16 files changed, 196 insertions, 175 deletions
diff --git a/include/acpi/processor.h b/include/acpi/processor.h index 3795590e152a..0574add2a1e3 100644 --- a/include/acpi/processor.h +++ b/include/acpi/processor.h | |||
@@ -127,7 +127,7 @@ struct acpi_processor_performance { | |||
127 | unsigned int state_count; | 127 | unsigned int state_count; |
128 | struct acpi_processor_px *states; | 128 | struct acpi_processor_px *states; |
129 | struct acpi_psd_package domain_info; | 129 | struct acpi_psd_package domain_info; |
130 | cpumask_t shared_cpu_map; | 130 | cpumask_var_t shared_cpu_map; |
131 | unsigned int shared_type; | 131 | unsigned int shared_type; |
132 | }; | 132 | }; |
133 | 133 | ||
@@ -172,7 +172,7 @@ struct acpi_processor_throttling { | |||
172 | unsigned int state_count; | 172 | unsigned int state_count; |
173 | struct acpi_processor_tx_tss *states_tss; | 173 | struct acpi_processor_tx_tss *states_tss; |
174 | struct acpi_tsd_package domain_info; | 174 | struct acpi_tsd_package domain_info; |
175 | cpumask_t shared_cpu_map; | 175 | cpumask_var_t shared_cpu_map; |
176 | int (*acpi_processor_get_throttling) (struct acpi_processor * pr); | 176 | int (*acpi_processor_get_throttling) (struct acpi_processor * pr); |
177 | int (*acpi_processor_set_throttling) (struct acpi_processor * pr, | 177 | int (*acpi_processor_set_throttling) (struct acpi_processor * pr, |
178 | int state); | 178 | int state); |
diff --git a/include/asm-frv/bitops.h b/include/asm-frv/bitops.h index 39456ba0ec17..287f6f697ce2 100644 --- a/include/asm-frv/bitops.h +++ b/include/asm-frv/bitops.h | |||
@@ -339,6 +339,19 @@ int __ffs(unsigned long x) | |||
339 | return 31 - bit; | 339 | return 31 - bit; |
340 | } | 340 | } |
341 | 341 | ||
342 | /** | ||
343 | * __fls - find last (most-significant) set bit in a long word | ||
344 | * @word: the word to search | ||
345 | * | ||
346 | * Undefined if no set bit exists, so code should check against 0 first. | ||
347 | */ | ||
348 | static inline unsigned long __fls(unsigned long word) | ||
349 | { | ||
350 | unsigned long bit; | ||
351 | asm("scan %1,gr0,%0" : "=r"(bit) : "r"(word)); | ||
352 | return bit; | ||
353 | } | ||
354 | |||
342 | /* | 355 | /* |
343 | * special slimline version of fls() for calculating ilog2_u32() | 356 | * special slimline version of fls() for calculating ilog2_u32() |
344 | * - note: no protection against n == 0 | 357 | * - note: no protection against n == 0 |
diff --git a/include/asm-m32r/bitops.h b/include/asm-m32r/bitops.h index 6dc9b81bf9f3..aaddf0d57603 100644 --- a/include/asm-m32r/bitops.h +++ b/include/asm-m32r/bitops.h | |||
@@ -251,6 +251,7 @@ static __inline__ int test_and_change_bit(int nr, volatile void * addr) | |||
251 | #include <asm-generic/bitops/ffz.h> | 251 | #include <asm-generic/bitops/ffz.h> |
252 | #include <asm-generic/bitops/__ffs.h> | 252 | #include <asm-generic/bitops/__ffs.h> |
253 | #include <asm-generic/bitops/fls.h> | 253 | #include <asm-generic/bitops/fls.h> |
254 | #include <asm-generic/bitops/__fls.h> | ||
254 | #include <asm-generic/bitops/fls64.h> | 255 | #include <asm-generic/bitops/fls64.h> |
255 | 256 | ||
256 | #ifdef __KERNEL__ | 257 | #ifdef __KERNEL__ |
diff --git a/include/asm-m68k/bitops.h b/include/asm-m68k/bitops.h index 3e8106442d5a..9bde784e7bad 100644 --- a/include/asm-m68k/bitops.h +++ b/include/asm-m68k/bitops.h | |||
@@ -315,6 +315,11 @@ static inline int fls(int x) | |||
315 | return 32 - cnt; | 315 | return 32 - cnt; |
316 | } | 316 | } |
317 | 317 | ||
318 | static inline int __fls(int x) | ||
319 | { | ||
320 | return fls(x) - 1; | ||
321 | } | ||
322 | |||
318 | #include <asm-generic/bitops/fls64.h> | 323 | #include <asm-generic/bitops/fls64.h> |
319 | #include <asm-generic/bitops/sched.h> | 324 | #include <asm-generic/bitops/sched.h> |
320 | #include <asm-generic/bitops/hweight.h> | 325 | #include <asm-generic/bitops/hweight.h> |
diff --git a/include/asm-mn10300/bitops.h b/include/asm-mn10300/bitops.h index cc6d40c05cf3..0b610f482abb 100644 --- a/include/asm-mn10300/bitops.h +++ b/include/asm-mn10300/bitops.h | |||
@@ -196,6 +196,17 @@ int fls(int x) | |||
196 | } | 196 | } |
197 | 197 | ||
198 | /** | 198 | /** |
199 | * __fls - find last (most-significant) set bit in a long word | ||
200 | * @word: the word to search | ||
201 | * | ||
202 | * Undefined if no set bit exists, so code should check against 0 first. | ||
203 | */ | ||
204 | static inline unsigned long __fls(unsigned long word) | ||
205 | { | ||
206 | return __ilog2_u32(word); | ||
207 | } | ||
208 | |||
209 | /** | ||
199 | * ffs - find first bit set | 210 | * ffs - find first bit set |
200 | * @x: the word to search | 211 | * @x: the word to search |
201 | * | 212 | * |
diff --git a/include/asm-xtensa/bitops.h b/include/asm-xtensa/bitops.h index 23261e8f2e5a..6c3930397bd3 100644 --- a/include/asm-xtensa/bitops.h +++ b/include/asm-xtensa/bitops.h | |||
@@ -82,6 +82,16 @@ static inline int fls (unsigned int x) | |||
82 | return 32 - __cntlz(x); | 82 | return 32 - __cntlz(x); |
83 | } | 83 | } |
84 | 84 | ||
85 | /** | ||
86 | * __fls - find last (most-significant) set bit in a long word | ||
87 | * @word: the word to search | ||
88 | * | ||
89 | * Undefined if no set bit exists, so code should check against 0 first. | ||
90 | */ | ||
91 | static inline unsigned long __fls(unsigned long word) | ||
92 | { | ||
93 | return 31 - __cntlz(word); | ||
94 | } | ||
85 | #else | 95 | #else |
86 | 96 | ||
87 | /* Use the generic implementation if we don't have the nsa/nsau instructions. */ | 97 | /* Use the generic implementation if we don't have the nsa/nsau instructions. */ |
@@ -90,6 +100,7 @@ static inline int fls (unsigned int x) | |||
90 | # include <asm-generic/bitops/__ffs.h> | 100 | # include <asm-generic/bitops/__ffs.h> |
91 | # include <asm-generic/bitops/ffz.h> | 101 | # include <asm-generic/bitops/ffz.h> |
92 | # include <asm-generic/bitops/fls.h> | 102 | # include <asm-generic/bitops/fls.h> |
103 | # include <asm-generic/bitops/__fls.h> | ||
93 | 104 | ||
94 | #endif | 105 | #endif |
95 | 106 | ||
diff --git a/include/linux/bitmap.h b/include/linux/bitmap.h index a08c33a26ca9..2878811c6134 100644 --- a/include/linux/bitmap.h +++ b/include/linux/bitmap.h | |||
@@ -137,9 +137,12 @@ extern void bitmap_copy_le(void *dst, const unsigned long *src, int nbits); | |||
137 | (1UL<<((nbits) % BITS_PER_LONG))-1 : ~0UL \ | 137 | (1UL<<((nbits) % BITS_PER_LONG))-1 : ~0UL \ |
138 | ) | 138 | ) |
139 | 139 | ||
140 | #define small_const_nbits(nbits) \ | ||
141 | (__builtin_constant_p(nbits) && (nbits) <= BITS_PER_LONG) | ||
142 | |||
140 | static inline void bitmap_zero(unsigned long *dst, int nbits) | 143 | static inline void bitmap_zero(unsigned long *dst, int nbits) |
141 | { | 144 | { |
142 | if (nbits <= BITS_PER_LONG) | 145 | if (small_const_nbits(nbits)) |
143 | *dst = 0UL; | 146 | *dst = 0UL; |
144 | else { | 147 | else { |
145 | int len = BITS_TO_LONGS(nbits) * sizeof(unsigned long); | 148 | int len = BITS_TO_LONGS(nbits) * sizeof(unsigned long); |
@@ -150,7 +153,7 @@ static inline void bitmap_zero(unsigned long *dst, int nbits) | |||
150 | static inline void bitmap_fill(unsigned long *dst, int nbits) | 153 | static inline void bitmap_fill(unsigned long *dst, int nbits) |
151 | { | 154 | { |
152 | size_t nlongs = BITS_TO_LONGS(nbits); | 155 | size_t nlongs = BITS_TO_LONGS(nbits); |
153 | if (nlongs > 1) { | 156 | if (!small_const_nbits(nbits)) { |
154 | int len = (nlongs - 1) * sizeof(unsigned long); | 157 | int len = (nlongs - 1) * sizeof(unsigned long); |
155 | memset(dst, 0xff, len); | 158 | memset(dst, 0xff, len); |
156 | } | 159 | } |
@@ -160,7 +163,7 @@ static inline void bitmap_fill(unsigned long *dst, int nbits) | |||
160 | static inline void bitmap_copy(unsigned long *dst, const unsigned long *src, | 163 | static inline void bitmap_copy(unsigned long *dst, const unsigned long *src, |
161 | int nbits) | 164 | int nbits) |
162 | { | 165 | { |
163 | if (nbits <= BITS_PER_LONG) | 166 | if (small_const_nbits(nbits)) |
164 | *dst = *src; | 167 | *dst = *src; |
165 | else { | 168 | else { |
166 | int len = BITS_TO_LONGS(nbits) * sizeof(unsigned long); | 169 | int len = BITS_TO_LONGS(nbits) * sizeof(unsigned long); |
@@ -171,7 +174,7 @@ static inline void bitmap_copy(unsigned long *dst, const unsigned long *src, | |||
171 | static inline void bitmap_and(unsigned long *dst, const unsigned long *src1, | 174 | static inline void bitmap_and(unsigned long *dst, const unsigned long *src1, |
172 | const unsigned long *src2, int nbits) | 175 | const unsigned long *src2, int nbits) |
173 | { | 176 | { |
174 | if (nbits <= BITS_PER_LONG) | 177 | if (small_const_nbits(nbits)) |
175 | *dst = *src1 & *src2; | 178 | *dst = *src1 & *src2; |
176 | else | 179 | else |
177 | __bitmap_and(dst, src1, src2, nbits); | 180 | __bitmap_and(dst, src1, src2, nbits); |
@@ -180,7 +183,7 @@ static inline void bitmap_and(unsigned long *dst, const unsigned long *src1, | |||
180 | static inline void bitmap_or(unsigned long *dst, const unsigned long *src1, | 183 | static inline void bitmap_or(unsigned long *dst, const unsigned long *src1, |
181 | const unsigned long *src2, int nbits) | 184 | const unsigned long *src2, int nbits) |
182 | { | 185 | { |
183 | if (nbits <= BITS_PER_LONG) | 186 | if (small_const_nbits(nbits)) |
184 | *dst = *src1 | *src2; | 187 | *dst = *src1 | *src2; |
185 | else | 188 | else |
186 | __bitmap_or(dst, src1, src2, nbits); | 189 | __bitmap_or(dst, src1, src2, nbits); |
@@ -189,7 +192,7 @@ static inline void bitmap_or(unsigned long *dst, const unsigned long *src1, | |||
189 | static inline void bitmap_xor(unsigned long *dst, const unsigned long *src1, | 192 | static inline void bitmap_xor(unsigned long *dst, const unsigned long *src1, |
190 | const unsigned long *src2, int nbits) | 193 | const unsigned long *src2, int nbits) |
191 | { | 194 | { |
192 | if (nbits <= BITS_PER_LONG) | 195 | if (small_const_nbits(nbits)) |
193 | *dst = *src1 ^ *src2; | 196 | *dst = *src1 ^ *src2; |
194 | else | 197 | else |
195 | __bitmap_xor(dst, src1, src2, nbits); | 198 | __bitmap_xor(dst, src1, src2, nbits); |
@@ -198,7 +201,7 @@ static inline void bitmap_xor(unsigned long *dst, const unsigned long *src1, | |||
198 | static inline void bitmap_andnot(unsigned long *dst, const unsigned long *src1, | 201 | static inline void bitmap_andnot(unsigned long *dst, const unsigned long *src1, |
199 | const unsigned long *src2, int nbits) | 202 | const unsigned long *src2, int nbits) |
200 | { | 203 | { |
201 | if (nbits <= BITS_PER_LONG) | 204 | if (small_const_nbits(nbits)) |
202 | *dst = *src1 & ~(*src2); | 205 | *dst = *src1 & ~(*src2); |
203 | else | 206 | else |
204 | __bitmap_andnot(dst, src1, src2, nbits); | 207 | __bitmap_andnot(dst, src1, src2, nbits); |
@@ -207,7 +210,7 @@ static inline void bitmap_andnot(unsigned long *dst, const unsigned long *src1, | |||
207 | static inline void bitmap_complement(unsigned long *dst, const unsigned long *src, | 210 | static inline void bitmap_complement(unsigned long *dst, const unsigned long *src, |
208 | int nbits) | 211 | int nbits) |
209 | { | 212 | { |
210 | if (nbits <= BITS_PER_LONG) | 213 | if (small_const_nbits(nbits)) |
211 | *dst = ~(*src) & BITMAP_LAST_WORD_MASK(nbits); | 214 | *dst = ~(*src) & BITMAP_LAST_WORD_MASK(nbits); |
212 | else | 215 | else |
213 | __bitmap_complement(dst, src, nbits); | 216 | __bitmap_complement(dst, src, nbits); |
@@ -216,7 +219,7 @@ static inline void bitmap_complement(unsigned long *dst, const unsigned long *sr | |||
216 | static inline int bitmap_equal(const unsigned long *src1, | 219 | static inline int bitmap_equal(const unsigned long *src1, |
217 | const unsigned long *src2, int nbits) | 220 | const unsigned long *src2, int nbits) |
218 | { | 221 | { |
219 | if (nbits <= BITS_PER_LONG) | 222 | if (small_const_nbits(nbits)) |
220 | return ! ((*src1 ^ *src2) & BITMAP_LAST_WORD_MASK(nbits)); | 223 | return ! ((*src1 ^ *src2) & BITMAP_LAST_WORD_MASK(nbits)); |
221 | else | 224 | else |
222 | return __bitmap_equal(src1, src2, nbits); | 225 | return __bitmap_equal(src1, src2, nbits); |
@@ -225,7 +228,7 @@ static inline int bitmap_equal(const unsigned long *src1, | |||
225 | static inline int bitmap_intersects(const unsigned long *src1, | 228 | static inline int bitmap_intersects(const unsigned long *src1, |
226 | const unsigned long *src2, int nbits) | 229 | const unsigned long *src2, int nbits) |
227 | { | 230 | { |
228 | if (nbits <= BITS_PER_LONG) | 231 | if (small_const_nbits(nbits)) |
229 | return ((*src1 & *src2) & BITMAP_LAST_WORD_MASK(nbits)) != 0; | 232 | return ((*src1 & *src2) & BITMAP_LAST_WORD_MASK(nbits)) != 0; |
230 | else | 233 | else |
231 | return __bitmap_intersects(src1, src2, nbits); | 234 | return __bitmap_intersects(src1, src2, nbits); |
@@ -234,7 +237,7 @@ static inline int bitmap_intersects(const unsigned long *src1, | |||
234 | static inline int bitmap_subset(const unsigned long *src1, | 237 | static inline int bitmap_subset(const unsigned long *src1, |
235 | const unsigned long *src2, int nbits) | 238 | const unsigned long *src2, int nbits) |
236 | { | 239 | { |
237 | if (nbits <= BITS_PER_LONG) | 240 | if (small_const_nbits(nbits)) |
238 | return ! ((*src1 & ~(*src2)) & BITMAP_LAST_WORD_MASK(nbits)); | 241 | return ! ((*src1 & ~(*src2)) & BITMAP_LAST_WORD_MASK(nbits)); |
239 | else | 242 | else |
240 | return __bitmap_subset(src1, src2, nbits); | 243 | return __bitmap_subset(src1, src2, nbits); |
@@ -242,7 +245,7 @@ static inline int bitmap_subset(const unsigned long *src1, | |||
242 | 245 | ||
243 | static inline int bitmap_empty(const unsigned long *src, int nbits) | 246 | static inline int bitmap_empty(const unsigned long *src, int nbits) |
244 | { | 247 | { |
245 | if (nbits <= BITS_PER_LONG) | 248 | if (small_const_nbits(nbits)) |
246 | return ! (*src & BITMAP_LAST_WORD_MASK(nbits)); | 249 | return ! (*src & BITMAP_LAST_WORD_MASK(nbits)); |
247 | else | 250 | else |
248 | return __bitmap_empty(src, nbits); | 251 | return __bitmap_empty(src, nbits); |
@@ -250,7 +253,7 @@ static inline int bitmap_empty(const unsigned long *src, int nbits) | |||
250 | 253 | ||
251 | static inline int bitmap_full(const unsigned long *src, int nbits) | 254 | static inline int bitmap_full(const unsigned long *src, int nbits) |
252 | { | 255 | { |
253 | if (nbits <= BITS_PER_LONG) | 256 | if (small_const_nbits(nbits)) |
254 | return ! (~(*src) & BITMAP_LAST_WORD_MASK(nbits)); | 257 | return ! (~(*src) & BITMAP_LAST_WORD_MASK(nbits)); |
255 | else | 258 | else |
256 | return __bitmap_full(src, nbits); | 259 | return __bitmap_full(src, nbits); |
@@ -258,7 +261,7 @@ static inline int bitmap_full(const unsigned long *src, int nbits) | |||
258 | 261 | ||
259 | static inline int bitmap_weight(const unsigned long *src, int nbits) | 262 | static inline int bitmap_weight(const unsigned long *src, int nbits) |
260 | { | 263 | { |
261 | if (nbits <= BITS_PER_LONG) | 264 | if (small_const_nbits(nbits)) |
262 | return hweight_long(*src & BITMAP_LAST_WORD_MASK(nbits)); | 265 | return hweight_long(*src & BITMAP_LAST_WORD_MASK(nbits)); |
263 | return __bitmap_weight(src, nbits); | 266 | return __bitmap_weight(src, nbits); |
264 | } | 267 | } |
@@ -266,7 +269,7 @@ static inline int bitmap_weight(const unsigned long *src, int nbits) | |||
266 | static inline void bitmap_shift_right(unsigned long *dst, | 269 | static inline void bitmap_shift_right(unsigned long *dst, |
267 | const unsigned long *src, int n, int nbits) | 270 | const unsigned long *src, int n, int nbits) |
268 | { | 271 | { |
269 | if (nbits <= BITS_PER_LONG) | 272 | if (small_const_nbits(nbits)) |
270 | *dst = *src >> n; | 273 | *dst = *src >> n; |
271 | else | 274 | else |
272 | __bitmap_shift_right(dst, src, n, nbits); | 275 | __bitmap_shift_right(dst, src, n, nbits); |
@@ -275,7 +278,7 @@ static inline void bitmap_shift_right(unsigned long *dst, | |||
275 | static inline void bitmap_shift_left(unsigned long *dst, | 278 | static inline void bitmap_shift_left(unsigned long *dst, |
276 | const unsigned long *src, int n, int nbits) | 279 | const unsigned long *src, int n, int nbits) |
277 | { | 280 | { |
278 | if (nbits <= BITS_PER_LONG) | 281 | if (small_const_nbits(nbits)) |
279 | *dst = (*src << n) & BITMAP_LAST_WORD_MASK(nbits); | 282 | *dst = (*src << n) & BITMAP_LAST_WORD_MASK(nbits); |
280 | else | 283 | else |
281 | __bitmap_shift_left(dst, src, n, nbits); | 284 | __bitmap_shift_left(dst, src, n, nbits); |
diff --git a/include/linux/bitops.h b/include/linux/bitops.h index 024f2b027244..61829139795a 100644 --- a/include/linux/bitops.h +++ b/include/linux/bitops.h | |||
@@ -134,9 +134,20 @@ extern unsigned long find_first_bit(const unsigned long *addr, | |||
134 | */ | 134 | */ |
135 | extern unsigned long find_first_zero_bit(const unsigned long *addr, | 135 | extern unsigned long find_first_zero_bit(const unsigned long *addr, |
136 | unsigned long size); | 136 | unsigned long size); |
137 | |||
138 | #endif /* CONFIG_GENERIC_FIND_FIRST_BIT */ | 137 | #endif /* CONFIG_GENERIC_FIND_FIRST_BIT */ |
139 | 138 | ||
139 | #ifdef CONFIG_GENERIC_FIND_LAST_BIT | ||
140 | /** | ||
141 | * find_last_bit - find the last set bit in a memory region | ||
142 | * @addr: The address to start the search at | ||
143 | * @size: The maximum size to search | ||
144 | * | ||
145 | * Returns the bit number of the first set bit, or size. | ||
146 | */ | ||
147 | extern unsigned long find_last_bit(const unsigned long *addr, | ||
148 | unsigned long size); | ||
149 | #endif /* CONFIG_GENERIC_FIND_LAST_BIT */ | ||
150 | |||
140 | #ifdef CONFIG_GENERIC_FIND_NEXT_BIT | 151 | #ifdef CONFIG_GENERIC_FIND_NEXT_BIT |
141 | 152 | ||
142 | /** | 153 | /** |
diff --git a/include/linux/cpumask.h b/include/linux/cpumask.h index d4bf52603e6b..9f315382610b 100644 --- a/include/linux/cpumask.h +++ b/include/linux/cpumask.h | |||
@@ -144,6 +144,7 @@ | |||
144 | typedef struct cpumask { DECLARE_BITMAP(bits, NR_CPUS); } cpumask_t; | 144 | typedef struct cpumask { DECLARE_BITMAP(bits, NR_CPUS); } cpumask_t; |
145 | extern cpumask_t _unused_cpumask_arg_; | 145 | extern cpumask_t _unused_cpumask_arg_; |
146 | 146 | ||
147 | #ifndef CONFIG_DISABLE_OBSOLETE_CPUMASK_FUNCTIONS | ||
147 | #define cpu_set(cpu, dst) __cpu_set((cpu), &(dst)) | 148 | #define cpu_set(cpu, dst) __cpu_set((cpu), &(dst)) |
148 | static inline void __cpu_set(int cpu, volatile cpumask_t *dstp) | 149 | static inline void __cpu_set(int cpu, volatile cpumask_t *dstp) |
149 | { | 150 | { |
@@ -267,6 +268,26 @@ static inline void __cpus_shift_left(cpumask_t *dstp, | |||
267 | { | 268 | { |
268 | bitmap_shift_left(dstp->bits, srcp->bits, n, nbits); | 269 | bitmap_shift_left(dstp->bits, srcp->bits, n, nbits); |
269 | } | 270 | } |
271 | #endif /* !CONFIG_DISABLE_OBSOLETE_CPUMASK_FUNCTIONS */ | ||
272 | |||
273 | /** | ||
274 | * to_cpumask - convert an NR_CPUS bitmap to a struct cpumask * | ||
275 | * @bitmap: the bitmap | ||
276 | * | ||
277 | * There are a few places where cpumask_var_t isn't appropriate and | ||
278 | * static cpumasks must be used (eg. very early boot), yet we don't | ||
279 | * expose the definition of 'struct cpumask'. | ||
280 | * | ||
281 | * This does the conversion, and can be used as a constant initializer. | ||
282 | */ | ||
283 | #define to_cpumask(bitmap) \ | ||
284 | ((struct cpumask *)(1 ? (bitmap) \ | ||
285 | : (void *)sizeof(__check_is_bitmap(bitmap)))) | ||
286 | |||
287 | static inline int __check_is_bitmap(const unsigned long *bitmap) | ||
288 | { | ||
289 | return 1; | ||
290 | } | ||
270 | 291 | ||
271 | /* | 292 | /* |
272 | * Special-case data structure for "single bit set only" constant CPU masks. | 293 | * Special-case data structure for "single bit set only" constant CPU masks. |
@@ -278,13 +299,14 @@ static inline void __cpus_shift_left(cpumask_t *dstp, | |||
278 | extern const unsigned long | 299 | extern const unsigned long |
279 | cpu_bit_bitmap[BITS_PER_LONG+1][BITS_TO_LONGS(NR_CPUS)]; | 300 | cpu_bit_bitmap[BITS_PER_LONG+1][BITS_TO_LONGS(NR_CPUS)]; |
280 | 301 | ||
281 | static inline const cpumask_t *get_cpu_mask(unsigned int cpu) | 302 | static inline const struct cpumask *get_cpu_mask(unsigned int cpu) |
282 | { | 303 | { |
283 | const unsigned long *p = cpu_bit_bitmap[1 + cpu % BITS_PER_LONG]; | 304 | const unsigned long *p = cpu_bit_bitmap[1 + cpu % BITS_PER_LONG]; |
284 | p -= cpu / BITS_PER_LONG; | 305 | p -= cpu / BITS_PER_LONG; |
285 | return (const cpumask_t *)p; | 306 | return to_cpumask(p); |
286 | } | 307 | } |
287 | 308 | ||
309 | #ifndef CONFIG_DISABLE_OBSOLETE_CPUMASK_FUNCTIONS | ||
288 | /* | 310 | /* |
289 | * In cases where we take the address of the cpumask immediately, | 311 | * In cases where we take the address of the cpumask immediately, |
290 | * gcc optimizes it out (it's a constant) and there's no huge stack | 312 | * gcc optimizes it out (it's a constant) and there's no huge stack |
@@ -370,19 +392,22 @@ static inline void __cpus_fold(cpumask_t *dstp, const cpumask_t *origp, | |||
370 | { | 392 | { |
371 | bitmap_fold(dstp->bits, origp->bits, sz, nbits); | 393 | bitmap_fold(dstp->bits, origp->bits, sz, nbits); |
372 | } | 394 | } |
395 | #endif /* !CONFIG_DISABLE_OBSOLETE_CPUMASK_FUNCTIONS */ | ||
373 | 396 | ||
374 | #if NR_CPUS == 1 | 397 | #if NR_CPUS == 1 |
375 | 398 | ||
376 | #define nr_cpu_ids 1 | 399 | #define nr_cpu_ids 1 |
400 | #ifndef CONFIG_DISABLE_OBSOLETE_CPUMASK_FUNCTIONS | ||
377 | #define first_cpu(src) ({ (void)(src); 0; }) | 401 | #define first_cpu(src) ({ (void)(src); 0; }) |
378 | #define next_cpu(n, src) ({ (void)(src); 1; }) | 402 | #define next_cpu(n, src) ({ (void)(src); 1; }) |
379 | #define any_online_cpu(mask) 0 | 403 | #define any_online_cpu(mask) 0 |
380 | #define for_each_cpu_mask(cpu, mask) \ | 404 | #define for_each_cpu_mask(cpu, mask) \ |
381 | for ((cpu) = 0; (cpu) < 1; (cpu)++, (void)mask) | 405 | for ((cpu) = 0; (cpu) < 1; (cpu)++, (void)mask) |
382 | 406 | #endif /* !CONFIG_DISABLE_OBSOLETE_CPUMASK_FUNCTIONS */ | |
383 | #else /* NR_CPUS > 1 */ | 407 | #else /* NR_CPUS > 1 */ |
384 | 408 | ||
385 | extern int nr_cpu_ids; | 409 | extern int nr_cpu_ids; |
410 | #ifndef CONFIG_DISABLE_OBSOLETE_CPUMASK_FUNCTIONS | ||
386 | int __first_cpu(const cpumask_t *srcp); | 411 | int __first_cpu(const cpumask_t *srcp); |
387 | int __next_cpu(int n, const cpumask_t *srcp); | 412 | int __next_cpu(int n, const cpumask_t *srcp); |
388 | int __any_online_cpu(const cpumask_t *mask); | 413 | int __any_online_cpu(const cpumask_t *mask); |
@@ -394,8 +419,10 @@ int __any_online_cpu(const cpumask_t *mask); | |||
394 | for ((cpu) = -1; \ | 419 | for ((cpu) = -1; \ |
395 | (cpu) = next_cpu((cpu), (mask)), \ | 420 | (cpu) = next_cpu((cpu), (mask)), \ |
396 | (cpu) < NR_CPUS; ) | 421 | (cpu) < NR_CPUS; ) |
422 | #endif /* !CONFIG_DISABLE_OBSOLETE_CPUMASK_FUNCTIONS */ | ||
397 | #endif | 423 | #endif |
398 | 424 | ||
425 | #ifndef CONFIG_DISABLE_OBSOLETE_CPUMASK_FUNCTIONS | ||
399 | #if NR_CPUS <= 64 | 426 | #if NR_CPUS <= 64 |
400 | 427 | ||
401 | #define next_cpu_nr(n, src) next_cpu(n, src) | 428 | #define next_cpu_nr(n, src) next_cpu(n, src) |
@@ -413,77 +440,67 @@ int __next_cpu_nr(int n, const cpumask_t *srcp); | |||
413 | (cpu) < nr_cpu_ids; ) | 440 | (cpu) < nr_cpu_ids; ) |
414 | 441 | ||
415 | #endif /* NR_CPUS > 64 */ | 442 | #endif /* NR_CPUS > 64 */ |
443 | #endif /* !CONFIG_DISABLE_OBSOLETE_CPUMASK_FUNCTIONS */ | ||
416 | 444 | ||
417 | /* | 445 | /* |
418 | * The following particular system cpumasks and operations manage | 446 | * The following particular system cpumasks and operations manage |
419 | * possible, present, active and online cpus. Each of them is a fixed size | 447 | * possible, present, active and online cpus. |
420 | * bitmap of size NR_CPUS. | ||
421 | * | 448 | * |
422 | * #ifdef CONFIG_HOTPLUG_CPU | 449 | * cpu_possible_mask- has bit 'cpu' set iff cpu is populatable |
423 | * cpu_possible_map - has bit 'cpu' set iff cpu is populatable | 450 | * cpu_present_mask - has bit 'cpu' set iff cpu is populated |
424 | * cpu_present_map - has bit 'cpu' set iff cpu is populated | 451 | * cpu_online_mask - has bit 'cpu' set iff cpu available to scheduler |
425 | * cpu_online_map - has bit 'cpu' set iff cpu available to scheduler | 452 | * cpu_active_mask - has bit 'cpu' set iff cpu available to migration |
426 | * cpu_active_map - has bit 'cpu' set iff cpu available to migration | ||
427 | * #else | ||
428 | * cpu_possible_map - has bit 'cpu' set iff cpu is populated | ||
429 | * cpu_present_map - copy of cpu_possible_map | ||
430 | * cpu_online_map - has bit 'cpu' set iff cpu available to scheduler | ||
431 | * #endif | ||
432 | * | 453 | * |
433 | * In either case, NR_CPUS is fixed at compile time, as the static | 454 | * If !CONFIG_HOTPLUG_CPU, present == possible, and active == online. |
434 | * size of these bitmaps. The cpu_possible_map is fixed at boot | ||
435 | * time, as the set of CPU id's that it is possible might ever | ||
436 | * be plugged in at anytime during the life of that system boot. | ||
437 | * The cpu_present_map is dynamic(*), representing which CPUs | ||
438 | * are currently plugged in. And cpu_online_map is the dynamic | ||
439 | * subset of cpu_present_map, indicating those CPUs available | ||
440 | * for scheduling. | ||
441 | * | 455 | * |
442 | * If HOTPLUG is enabled, then cpu_possible_map is forced to have | 456 | * The cpu_possible_mask is fixed at boot time, as the set of CPU id's |
457 | * that it is possible might ever be plugged in at anytime during the | ||
458 | * life of that system boot. The cpu_present_mask is dynamic(*), | ||
459 | * representing which CPUs are currently plugged in. And | ||
460 | * cpu_online_mask is the dynamic subset of cpu_present_mask, | ||
461 | * indicating those CPUs available for scheduling. | ||
462 | * | ||
463 | * If HOTPLUG is enabled, then cpu_possible_mask is forced to have | ||
443 | * all NR_CPUS bits set, otherwise it is just the set of CPUs that | 464 | * all NR_CPUS bits set, otherwise it is just the set of CPUs that |
444 | * ACPI reports present at boot. | 465 | * ACPI reports present at boot. |
445 | * | 466 | * |
446 | * If HOTPLUG is enabled, then cpu_present_map varies dynamically, | 467 | * If HOTPLUG is enabled, then cpu_present_mask varies dynamically, |
447 | * depending on what ACPI reports as currently plugged in, otherwise | 468 | * depending on what ACPI reports as currently plugged in, otherwise |
448 | * cpu_present_map is just a copy of cpu_possible_map. | 469 | * cpu_present_mask is just a copy of cpu_possible_mask. |
449 | * | 470 | * |
450 | * (*) Well, cpu_present_map is dynamic in the hotplug case. If not | 471 | * (*) Well, cpu_present_mask is dynamic in the hotplug case. If not |
451 | * hotplug, it's a copy of cpu_possible_map, hence fixed at boot. | 472 | * hotplug, it's a copy of cpu_possible_mask, hence fixed at boot. |
452 | * | 473 | * |
453 | * Subtleties: | 474 | * Subtleties: |
454 | * 1) UP arch's (NR_CPUS == 1, CONFIG_SMP not defined) hardcode | 475 | * 1) UP arch's (NR_CPUS == 1, CONFIG_SMP not defined) hardcode |
455 | * assumption that their single CPU is online. The UP | 476 | * assumption that their single CPU is online. The UP |
456 | * cpu_{online,possible,present}_maps are placebos. Changing them | 477 | * cpu_{online,possible,present}_masks are placebos. Changing them |
457 | * will have no useful affect on the following num_*_cpus() | 478 | * will have no useful affect on the following num_*_cpus() |
458 | * and cpu_*() macros in the UP case. This ugliness is a UP | 479 | * and cpu_*() macros in the UP case. This ugliness is a UP |
459 | * optimization - don't waste any instructions or memory references | 480 | * optimization - don't waste any instructions or memory references |
460 | * asking if you're online or how many CPUs there are if there is | 481 | * asking if you're online or how many CPUs there are if there is |
461 | * only one CPU. | 482 | * only one CPU. |
462 | * 2) Most SMP arch's #define some of these maps to be some | ||
463 | * other map specific to that arch. Therefore, the following | ||
464 | * must be #define macros, not inlines. To see why, examine | ||
465 | * the assembly code produced by the following. Note that | ||
466 | * set1() writes phys_x_map, but set2() writes x_map: | ||
467 | * int x_map, phys_x_map; | ||
468 | * #define set1(a) x_map = a | ||
469 | * inline void set2(int a) { x_map = a; } | ||
470 | * #define x_map phys_x_map | ||
471 | * main(){ set1(3); set2(5); } | ||
472 | */ | 483 | */ |
473 | 484 | ||
474 | extern cpumask_t cpu_possible_map; | 485 | extern const struct cpumask *const cpu_possible_mask; |
475 | extern cpumask_t cpu_online_map; | 486 | extern const struct cpumask *const cpu_online_mask; |
476 | extern cpumask_t cpu_present_map; | 487 | extern const struct cpumask *const cpu_present_mask; |
477 | extern cpumask_t cpu_active_map; | 488 | extern const struct cpumask *const cpu_active_mask; |
489 | |||
490 | /* These strip const, as traditionally they weren't const. */ | ||
491 | #define cpu_possible_map (*(cpumask_t *)cpu_possible_mask) | ||
492 | #define cpu_online_map (*(cpumask_t *)cpu_online_mask) | ||
493 | #define cpu_present_map (*(cpumask_t *)cpu_present_mask) | ||
494 | #define cpu_active_map (*(cpumask_t *)cpu_active_mask) | ||
478 | 495 | ||
479 | #if NR_CPUS > 1 | 496 | #if NR_CPUS > 1 |
480 | #define num_online_cpus() cpus_weight_nr(cpu_online_map) | 497 | #define num_online_cpus() cpumask_weight(cpu_online_mask) |
481 | #define num_possible_cpus() cpus_weight_nr(cpu_possible_map) | 498 | #define num_possible_cpus() cpumask_weight(cpu_possible_mask) |
482 | #define num_present_cpus() cpus_weight_nr(cpu_present_map) | 499 | #define num_present_cpus() cpumask_weight(cpu_present_mask) |
483 | #define cpu_online(cpu) cpu_isset((cpu), cpu_online_map) | 500 | #define cpu_online(cpu) cpumask_test_cpu((cpu), cpu_online_mask) |
484 | #define cpu_possible(cpu) cpu_isset((cpu), cpu_possible_map) | 501 | #define cpu_possible(cpu) cpumask_test_cpu((cpu), cpu_possible_mask) |
485 | #define cpu_present(cpu) cpu_isset((cpu), cpu_present_map) | 502 | #define cpu_present(cpu) cpumask_test_cpu((cpu), cpu_present_mask) |
486 | #define cpu_active(cpu) cpu_isset((cpu), cpu_active_map) | 503 | #define cpu_active(cpu) cpumask_test_cpu((cpu), cpu_active_mask) |
487 | #else | 504 | #else |
488 | #define num_online_cpus() 1 | 505 | #define num_online_cpus() 1 |
489 | #define num_possible_cpus() 1 | 506 | #define num_possible_cpus() 1 |
@@ -496,10 +513,6 @@ extern cpumask_t cpu_active_map; | |||
496 | 513 | ||
497 | #define cpu_is_offline(cpu) unlikely(!cpu_online(cpu)) | 514 | #define cpu_is_offline(cpu) unlikely(!cpu_online(cpu)) |
498 | 515 | ||
499 | #define for_each_possible_cpu(cpu) for_each_cpu_mask_nr((cpu), cpu_possible_map) | ||
500 | #define for_each_online_cpu(cpu) for_each_cpu_mask_nr((cpu), cpu_online_map) | ||
501 | #define for_each_present_cpu(cpu) for_each_cpu_mask_nr((cpu), cpu_present_map) | ||
502 | |||
503 | /* These are the new versions of the cpumask operators: passed by pointer. | 516 | /* These are the new versions of the cpumask operators: passed by pointer. |
504 | * The older versions will be implemented in terms of these, then deleted. */ | 517 | * The older versions will be implemented in terms of these, then deleted. */ |
505 | #define cpumask_bits(maskp) ((maskp)->bits) | 518 | #define cpumask_bits(maskp) ((maskp)->bits) |
@@ -687,7 +700,7 @@ static inline void cpumask_clear_cpu(int cpu, struct cpumask *dstp) | |||
687 | * No static inline type checking - see Subtlety (1) above. | 700 | * No static inline type checking - see Subtlety (1) above. |
688 | */ | 701 | */ |
689 | #define cpumask_test_cpu(cpu, cpumask) \ | 702 | #define cpumask_test_cpu(cpu, cpumask) \ |
690 | test_bit(cpumask_check(cpu), (cpumask)->bits) | 703 | test_bit(cpumask_check(cpu), cpumask_bits((cpumask))) |
691 | 704 | ||
692 | /** | 705 | /** |
693 | * cpumask_test_and_set_cpu - atomically test and set a cpu in a cpumask | 706 | * cpumask_test_and_set_cpu - atomically test and set a cpu in a cpumask |
@@ -930,7 +943,7 @@ static inline void cpumask_copy(struct cpumask *dstp, | |||
930 | static inline int cpumask_scnprintf(char *buf, int len, | 943 | static inline int cpumask_scnprintf(char *buf, int len, |
931 | const struct cpumask *srcp) | 944 | const struct cpumask *srcp) |
932 | { | 945 | { |
933 | return bitmap_scnprintf(buf, len, srcp->bits, nr_cpumask_bits); | 946 | return bitmap_scnprintf(buf, len, cpumask_bits(srcp), nr_cpumask_bits); |
934 | } | 947 | } |
935 | 948 | ||
936 | /** | 949 | /** |
@@ -944,7 +957,7 @@ static inline int cpumask_scnprintf(char *buf, int len, | |||
944 | static inline int cpumask_parse_user(const char __user *buf, int len, | 957 | static inline int cpumask_parse_user(const char __user *buf, int len, |
945 | struct cpumask *dstp) | 958 | struct cpumask *dstp) |
946 | { | 959 | { |
947 | return bitmap_parse_user(buf, len, dstp->bits, nr_cpumask_bits); | 960 | return bitmap_parse_user(buf, len, cpumask_bits(dstp), nr_cpumask_bits); |
948 | } | 961 | } |
949 | 962 | ||
950 | /** | 963 | /** |
@@ -959,7 +972,8 @@ static inline int cpumask_parse_user(const char __user *buf, int len, | |||
959 | static inline int cpulist_scnprintf(char *buf, int len, | 972 | static inline int cpulist_scnprintf(char *buf, int len, |
960 | const struct cpumask *srcp) | 973 | const struct cpumask *srcp) |
961 | { | 974 | { |
962 | return bitmap_scnlistprintf(buf, len, srcp->bits, nr_cpumask_bits); | 975 | return bitmap_scnlistprintf(buf, len, cpumask_bits(srcp), |
976 | nr_cpumask_bits); | ||
963 | } | 977 | } |
964 | 978 | ||
965 | /** | 979 | /** |
@@ -972,26 +986,7 @@ static inline int cpulist_scnprintf(char *buf, int len, | |||
972 | */ | 986 | */ |
973 | static inline int cpulist_parse(const char *buf, struct cpumask *dstp) | 987 | static inline int cpulist_parse(const char *buf, struct cpumask *dstp) |
974 | { | 988 | { |
975 | return bitmap_parselist(buf, dstp->bits, nr_cpumask_bits); | 989 | return bitmap_parselist(buf, cpumask_bits(dstp), nr_cpumask_bits); |
976 | } | ||
977 | |||
978 | /** | ||
979 | * to_cpumask - convert an NR_CPUS bitmap to a struct cpumask * | ||
980 | * @bitmap: the bitmap | ||
981 | * | ||
982 | * There are a few places where cpumask_var_t isn't appropriate and | ||
983 | * static cpumasks must be used (eg. very early boot), yet we don't | ||
984 | * expose the definition of 'struct cpumask'. | ||
985 | * | ||
986 | * This does the conversion, and can be used as a constant initializer. | ||
987 | */ | ||
988 | #define to_cpumask(bitmap) \ | ||
989 | ((struct cpumask *)(1 ? (bitmap) \ | ||
990 | : (void *)sizeof(__check_is_bitmap(bitmap)))) | ||
991 | |||
992 | static inline int __check_is_bitmap(const unsigned long *bitmap) | ||
993 | { | ||
994 | return 1; | ||
995 | } | 990 | } |
996 | 991 | ||
997 | /** | 992 | /** |
@@ -1025,6 +1020,7 @@ static inline size_t cpumask_size(void) | |||
1025 | #ifdef CONFIG_CPUMASK_OFFSTACK | 1020 | #ifdef CONFIG_CPUMASK_OFFSTACK |
1026 | typedef struct cpumask *cpumask_var_t; | 1021 | typedef struct cpumask *cpumask_var_t; |
1027 | 1022 | ||
1023 | bool alloc_cpumask_var_node(cpumask_var_t *mask, gfp_t flags, int node); | ||
1028 | bool alloc_cpumask_var(cpumask_var_t *mask, gfp_t flags); | 1024 | bool alloc_cpumask_var(cpumask_var_t *mask, gfp_t flags); |
1029 | void alloc_bootmem_cpumask_var(cpumask_var_t *mask); | 1025 | void alloc_bootmem_cpumask_var(cpumask_var_t *mask); |
1030 | void free_cpumask_var(cpumask_var_t mask); | 1026 | void free_cpumask_var(cpumask_var_t mask); |
@@ -1038,6 +1034,12 @@ static inline bool alloc_cpumask_var(cpumask_var_t *mask, gfp_t flags) | |||
1038 | return true; | 1034 | return true; |
1039 | } | 1035 | } |
1040 | 1036 | ||
1037 | static inline bool alloc_cpumask_var_node(cpumask_var_t *mask, gfp_t flags, | ||
1038 | int node) | ||
1039 | { | ||
1040 | return true; | ||
1041 | } | ||
1042 | |||
1041 | static inline void alloc_bootmem_cpumask_var(cpumask_var_t *mask) | 1043 | static inline void alloc_bootmem_cpumask_var(cpumask_var_t *mask) |
1042 | { | 1044 | { |
1043 | } | 1045 | } |
@@ -1051,12 +1053,6 @@ static inline void free_bootmem_cpumask_var(cpumask_var_t mask) | |||
1051 | } | 1053 | } |
1052 | #endif /* CONFIG_CPUMASK_OFFSTACK */ | 1054 | #endif /* CONFIG_CPUMASK_OFFSTACK */ |
1053 | 1055 | ||
1054 | /* The pointer versions of the maps, these will become the primary versions. */ | ||
1055 | #define cpu_possible_mask ((const struct cpumask *)&cpu_possible_map) | ||
1056 | #define cpu_online_mask ((const struct cpumask *)&cpu_online_map) | ||
1057 | #define cpu_present_mask ((const struct cpumask *)&cpu_present_map) | ||
1058 | #define cpu_active_mask ((const struct cpumask *)&cpu_active_map) | ||
1059 | |||
1060 | /* It's common to want to use cpu_all_mask in struct member initializers, | 1056 | /* It's common to want to use cpu_all_mask in struct member initializers, |
1061 | * so it has to refer to an address rather than a pointer. */ | 1057 | * so it has to refer to an address rather than a pointer. */ |
1062 | extern const DECLARE_BITMAP(cpu_all_bits, NR_CPUS); | 1058 | extern const DECLARE_BITMAP(cpu_all_bits, NR_CPUS); |
@@ -1065,51 +1061,16 @@ extern const DECLARE_BITMAP(cpu_all_bits, NR_CPUS); | |||
1065 | /* First bits of cpu_bit_bitmap are in fact unset. */ | 1061 | /* First bits of cpu_bit_bitmap are in fact unset. */ |
1066 | #define cpu_none_mask to_cpumask(cpu_bit_bitmap[0]) | 1062 | #define cpu_none_mask to_cpumask(cpu_bit_bitmap[0]) |
1067 | 1063 | ||
1068 | /* Wrappers for arch boot code to manipulate normally-constant masks */ | 1064 | #define for_each_possible_cpu(cpu) for_each_cpu((cpu), cpu_possible_mask) |
1069 | static inline void set_cpu_possible(unsigned int cpu, bool possible) | 1065 | #define for_each_online_cpu(cpu) for_each_cpu((cpu), cpu_online_mask) |
1070 | { | 1066 | #define for_each_present_cpu(cpu) for_each_cpu((cpu), cpu_present_mask) |
1071 | if (possible) | ||
1072 | cpumask_set_cpu(cpu, &cpu_possible_map); | ||
1073 | else | ||
1074 | cpumask_clear_cpu(cpu, &cpu_possible_map); | ||
1075 | } | ||
1076 | |||
1077 | static inline void set_cpu_present(unsigned int cpu, bool present) | ||
1078 | { | ||
1079 | if (present) | ||
1080 | cpumask_set_cpu(cpu, &cpu_present_map); | ||
1081 | else | ||
1082 | cpumask_clear_cpu(cpu, &cpu_present_map); | ||
1083 | } | ||
1084 | |||
1085 | static inline void set_cpu_online(unsigned int cpu, bool online) | ||
1086 | { | ||
1087 | if (online) | ||
1088 | cpumask_set_cpu(cpu, &cpu_online_map); | ||
1089 | else | ||
1090 | cpumask_clear_cpu(cpu, &cpu_online_map); | ||
1091 | } | ||
1092 | 1067 | ||
1093 | static inline void set_cpu_active(unsigned int cpu, bool active) | 1068 | /* Wrappers for arch boot code to manipulate normally-constant masks */ |
1094 | { | 1069 | void set_cpu_possible(unsigned int cpu, bool possible); |
1095 | if (active) | 1070 | void set_cpu_present(unsigned int cpu, bool present); |
1096 | cpumask_set_cpu(cpu, &cpu_active_map); | 1071 | void set_cpu_online(unsigned int cpu, bool online); |
1097 | else | 1072 | void set_cpu_active(unsigned int cpu, bool active); |
1098 | cpumask_clear_cpu(cpu, &cpu_active_map); | 1073 | void init_cpu_present(const struct cpumask *src); |
1099 | } | 1074 | void init_cpu_possible(const struct cpumask *src); |
1100 | 1075 | void init_cpu_online(const struct cpumask *src); | |
1101 | static inline void init_cpu_present(const struct cpumask *src) | ||
1102 | { | ||
1103 | cpumask_copy(&cpu_present_map, src); | ||
1104 | } | ||
1105 | |||
1106 | static inline void init_cpu_possible(const struct cpumask *src) | ||
1107 | { | ||
1108 | cpumask_copy(&cpu_possible_map, src); | ||
1109 | } | ||
1110 | |||
1111 | static inline void init_cpu_online(const struct cpumask *src) | ||
1112 | { | ||
1113 | cpumask_copy(&cpu_online_map, src); | ||
1114 | } | ||
1115 | #endif /* __LINUX_CPUMASK_H */ | 1076 | #endif /* __LINUX_CPUMASK_H */ |
diff --git a/include/linux/interrupt.h b/include/linux/interrupt.h index 990355fbc54e..0702c4d7bdf0 100644 --- a/include/linux/interrupt.h +++ b/include/linux/interrupt.h | |||
@@ -109,7 +109,7 @@ extern void enable_irq(unsigned int irq); | |||
109 | 109 | ||
110 | #if defined(CONFIG_SMP) && defined(CONFIG_GENERIC_HARDIRQS) | 110 | #if defined(CONFIG_SMP) && defined(CONFIG_GENERIC_HARDIRQS) |
111 | 111 | ||
112 | extern cpumask_t irq_default_affinity; | 112 | extern cpumask_var_t irq_default_affinity; |
113 | 113 | ||
114 | extern int irq_set_affinity(unsigned int irq, const struct cpumask *cpumask); | 114 | extern int irq_set_affinity(unsigned int irq, const struct cpumask *cpumask); |
115 | extern int irq_can_set_affinity(unsigned int irq); | 115 | extern int irq_can_set_affinity(unsigned int irq); |
diff --git a/include/linux/rcuclassic.h b/include/linux/rcuclassic.h index 301dda829e37..f3f697df1d71 100644 --- a/include/linux/rcuclassic.h +++ b/include/linux/rcuclassic.h | |||
@@ -59,8 +59,8 @@ struct rcu_ctrlblk { | |||
59 | int signaled; | 59 | int signaled; |
60 | 60 | ||
61 | spinlock_t lock ____cacheline_internodealigned_in_smp; | 61 | spinlock_t lock ____cacheline_internodealigned_in_smp; |
62 | cpumask_t cpumask; /* CPUs that need to switch in order */ | 62 | DECLARE_BITMAP(cpumask, NR_CPUS); /* CPUs that need to switch for */ |
63 | /* for current batch to proceed. */ | 63 | /* current batch to proceed. */ |
64 | } ____cacheline_internodealigned_in_smp; | 64 | } ____cacheline_internodealigned_in_smp; |
65 | 65 | ||
66 | /* Is batch a before batch b ? */ | 66 | /* Is batch a before batch b ? */ |
diff --git a/include/linux/seq_file.h b/include/linux/seq_file.h index b3dfa72f13b9..40ea5058c2ec 100644 --- a/include/linux/seq_file.h +++ b/include/linux/seq_file.h | |||
@@ -50,10 +50,11 @@ int seq_path(struct seq_file *, struct path *, char *); | |||
50 | int seq_dentry(struct seq_file *, struct dentry *, char *); | 50 | int seq_dentry(struct seq_file *, struct dentry *, char *); |
51 | int seq_path_root(struct seq_file *m, struct path *path, struct path *root, | 51 | int seq_path_root(struct seq_file *m, struct path *path, struct path *root, |
52 | char *esc); | 52 | char *esc); |
53 | int seq_bitmap(struct seq_file *m, unsigned long *bits, unsigned int nr_bits); | 53 | int seq_bitmap(struct seq_file *m, const unsigned long *bits, |
54 | static inline int seq_cpumask(struct seq_file *m, cpumask_t *mask) | 54 | unsigned int nr_bits); |
55 | static inline int seq_cpumask(struct seq_file *m, const struct cpumask *mask) | ||
55 | { | 56 | { |
56 | return seq_bitmap(m, mask->bits, NR_CPUS); | 57 | return seq_bitmap(m, mask->bits, nr_cpu_ids); |
57 | } | 58 | } |
58 | 59 | ||
59 | static inline int seq_nodemask(struct seq_file *m, nodemask_t *mask) | 60 | static inline int seq_nodemask(struct seq_file *m, nodemask_t *mask) |
diff --git a/include/linux/smp.h b/include/linux/smp.h index 6e7ba16ff454..b82466968101 100644 --- a/include/linux/smp.h +++ b/include/linux/smp.h | |||
@@ -21,6 +21,9 @@ struct call_single_data { | |||
21 | u16 priv; | 21 | u16 priv; |
22 | }; | 22 | }; |
23 | 23 | ||
24 | /* total number of cpus in this system (may exceed NR_CPUS) */ | ||
25 | extern unsigned int total_cpus; | ||
26 | |||
24 | #ifdef CONFIG_SMP | 27 | #ifdef CONFIG_SMP |
25 | 28 | ||
26 | #include <linux/preempt.h> | 29 | #include <linux/preempt.h> |
@@ -64,15 +67,16 @@ extern void smp_cpus_done(unsigned int max_cpus); | |||
64 | * Call a function on all other processors | 67 | * Call a function on all other processors |
65 | */ | 68 | */ |
66 | int smp_call_function(void(*func)(void *info), void *info, int wait); | 69 | int smp_call_function(void(*func)(void *info), void *info, int wait); |
67 | /* Deprecated: use smp_call_function_many() which uses a cpumask ptr. */ | 70 | void smp_call_function_many(const struct cpumask *mask, |
68 | int smp_call_function_mask(cpumask_t mask, void(*func)(void *info), void *info, | 71 | void (*func)(void *info), void *info, bool wait); |
69 | int wait); | ||
70 | 72 | ||
71 | static inline void smp_call_function_many(const struct cpumask *mask, | 73 | /* Deprecated: Use smp_call_function_many which takes a pointer to the mask. */ |
72 | void (*func)(void *info), void *info, | 74 | static inline int |
73 | int wait) | 75 | smp_call_function_mask(cpumask_t mask, void(*func)(void *info), void *info, |
76 | int wait) | ||
74 | { | 77 | { |
75 | smp_call_function_mask(*mask, func, info, wait); | 78 | smp_call_function_many(&mask, func, info, wait); |
79 | return 0; | ||
76 | } | 80 | } |
77 | 81 | ||
78 | int smp_call_function_single(int cpuid, void (*func) (void *info), void *info, | 82 | int smp_call_function_single(int cpuid, void (*func) (void *info), void *info, |
diff --git a/include/linux/stop_machine.h b/include/linux/stop_machine.h index faf1519b5adc..74d59a641362 100644 --- a/include/linux/stop_machine.h +++ b/include/linux/stop_machine.h | |||
@@ -23,7 +23,7 @@ | |||
23 | * | 23 | * |
24 | * This can be thought of as a very heavy write lock, equivalent to | 24 | * This can be thought of as a very heavy write lock, equivalent to |
25 | * grabbing every spinlock in the kernel. */ | 25 | * grabbing every spinlock in the kernel. */ |
26 | int stop_machine(int (*fn)(void *), void *data, const cpumask_t *cpus); | 26 | int stop_machine(int (*fn)(void *), void *data, const struct cpumask *cpus); |
27 | 27 | ||
28 | /** | 28 | /** |
29 | * __stop_machine: freeze the machine on all CPUs and run this function | 29 | * __stop_machine: freeze the machine on all CPUs and run this function |
@@ -34,11 +34,11 @@ int stop_machine(int (*fn)(void *), void *data, const cpumask_t *cpus); | |||
34 | * Description: This is a special version of the above, which assumes cpus | 34 | * Description: This is a special version of the above, which assumes cpus |
35 | * won't come or go while it's being called. Used by hotplug cpu. | 35 | * won't come or go while it's being called. Used by hotplug cpu. |
36 | */ | 36 | */ |
37 | int __stop_machine(int (*fn)(void *), void *data, const cpumask_t *cpus); | 37 | int __stop_machine(int (*fn)(void *), void *data, const struct cpumask *cpus); |
38 | #else | 38 | #else |
39 | 39 | ||
40 | static inline int stop_machine(int (*fn)(void *), void *data, | 40 | static inline int stop_machine(int (*fn)(void *), void *data, |
41 | const cpumask_t *cpus) | 41 | const struct cpumask *cpus) |
42 | { | 42 | { |
43 | int ret; | 43 | int ret; |
44 | local_irq_disable(); | 44 | local_irq_disable(); |
diff --git a/include/linux/threads.h b/include/linux/threads.h index 38d1a5d6568e..052b12bec8bd 100644 --- a/include/linux/threads.h +++ b/include/linux/threads.h | |||
@@ -8,17 +8,17 @@ | |||
8 | */ | 8 | */ |
9 | 9 | ||
10 | /* | 10 | /* |
11 | * Maximum supported processors that can run under SMP. This value is | 11 | * Maximum supported processors. Setting this smaller saves quite a |
12 | * set via configure setting. The maximum is equal to the size of the | 12 | * bit of memory. Use nr_cpu_ids instead of this except for static bitmaps. |
13 | * bitmasks used on that platform, i.e. 32 or 64. Setting this smaller | ||
14 | * saves quite a bit of memory. | ||
15 | */ | 13 | */ |
16 | #ifdef CONFIG_SMP | 14 | #ifndef CONFIG_NR_CPUS |
17 | #define NR_CPUS CONFIG_NR_CPUS | 15 | /* FIXME: This should be fixed in the arch's Kconfig */ |
18 | #else | 16 | #define CONFIG_NR_CPUS 1 |
19 | #define NR_CPUS 1 | ||
20 | #endif | 17 | #endif |
21 | 18 | ||
19 | /* Places which use this should consider cpumask_var_t. */ | ||
20 | #define NR_CPUS CONFIG_NR_CPUS | ||
21 | |||
22 | #define MIN_THREADS_LEFT_FOR_ROOT 4 | 22 | #define MIN_THREADS_LEFT_FOR_ROOT 4 |
23 | 23 | ||
24 | /* | 24 | /* |
diff --git a/include/linux/tick.h b/include/linux/tick.h index b6ec8189ac0c..469b82d88b3b 100644 --- a/include/linux/tick.h +++ b/include/linux/tick.h | |||
@@ -84,10 +84,10 @@ static inline void tick_cancel_sched_timer(int cpu) { } | |||
84 | 84 | ||
85 | # ifdef CONFIG_GENERIC_CLOCKEVENTS_BROADCAST | 85 | # ifdef CONFIG_GENERIC_CLOCKEVENTS_BROADCAST |
86 | extern struct tick_device *tick_get_broadcast_device(void); | 86 | extern struct tick_device *tick_get_broadcast_device(void); |
87 | extern cpumask_t *tick_get_broadcast_mask(void); | 87 | extern struct cpumask *tick_get_broadcast_mask(void); |
88 | 88 | ||
89 | # ifdef CONFIG_TICK_ONESHOT | 89 | # ifdef CONFIG_TICK_ONESHOT |
90 | extern cpumask_t *tick_get_broadcast_oneshot_mask(void); | 90 | extern struct cpumask *tick_get_broadcast_oneshot_mask(void); |
91 | # endif | 91 | # endif |
92 | 92 | ||
93 | # endif /* BROADCAST */ | 93 | # endif /* BROADCAST */ |