cpumask: Optimize cpumask_of_cpu in lib/smp_processor_id.c
[linux-block.git] / include / linux / cpumask.h
CommitLineData
1da177e4
LT
1#ifndef __LINUX_CPUMASK_H
2#define __LINUX_CPUMASK_H
3
4/*
5 * Cpumasks provide a bitmap suitable for representing the
6 * set of CPU's in a system, one bit position per CPU number.
7 *
8 * See detailed comments in the file linux/bitmap.h describing the
9 * data type on which these cpumasks are based.
10 *
01a3ee2b
RC
11 * For details of cpumask_scnprintf() and cpumask_parse_user(),
12 * see bitmap_scnprintf() and bitmap_parse_user() in lib/bitmap.c.
1da177e4
LT
13 * For details of cpulist_scnprintf() and cpulist_parse(), see
14 * bitmap_scnlistprintf() and bitmap_parselist(), also in bitmap.c.
fb5eeeee
PJ
15 * For details of cpu_remap(), see bitmap_bitremap in lib/bitmap.c
16 * For details of cpus_remap(), see bitmap_remap in lib/bitmap.c.
7ea931c9
PJ
17 * For details of cpus_onto(), see bitmap_onto in lib/bitmap.c.
18 * For details of cpus_fold(), see bitmap_fold in lib/bitmap.c.
1da177e4 19 *
41df0d61
MT
20 * . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
21 * Note: The alternate operations with the suffix "_nr" are used
22 * to limit the range of the loop to nr_cpu_ids instead of
23 * NR_CPUS when NR_CPUS > 64 for performance reasons.
24 * If NR_CPUS is <= 64 then most assembler bitmask
25 * operators execute faster with a constant range, so
26 * the operator will continue to use NR_CPUS.
27 *
28 * Another consideration is that nr_cpu_ids is initialized
29 * to NR_CPUS and isn't lowered until the possible cpus are
30 * discovered (including any disabled cpus). So early uses
31 * will span the entire range of NR_CPUS.
32 * . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
33 *
1da177e4
LT
34 * The available cpumask operations are:
35 *
36 * void cpu_set(cpu, mask) turn on bit 'cpu' in mask
37 * void cpu_clear(cpu, mask) turn off bit 'cpu' in mask
38 * void cpus_setall(mask) set all bits
39 * void cpus_clear(mask) clear all bits
40 * int cpu_isset(cpu, mask) true iff bit 'cpu' set in mask
41 * int cpu_test_and_set(cpu, mask) test and set bit 'cpu' in mask
42 *
43 * void cpus_and(dst, src1, src2) dst = src1 & src2 [intersection]
44 * void cpus_or(dst, src1, src2) dst = src1 | src2 [union]
45 * void cpus_xor(dst, src1, src2) dst = src1 ^ src2
46 * void cpus_andnot(dst, src1, src2) dst = src1 & ~src2
47 * void cpus_complement(dst, src) dst = ~src
48 *
49 * int cpus_equal(mask1, mask2) Does mask1 == mask2?
50 * int cpus_intersects(mask1, mask2) Do mask1 and mask2 intersect?
51 * int cpus_subset(mask1, mask2) Is mask1 a subset of mask2?
52 * int cpus_empty(mask) Is mask empty (no bits sets)?
53 * int cpus_full(mask) Is mask full (all bits sets)?
54 * int cpus_weight(mask) Hamming weigh - number of set bits
41df0d61 55 * int cpus_weight_nr(mask) Same using nr_cpu_ids instead of NR_CPUS
1da177e4
LT
56 *
57 * void cpus_shift_right(dst, src, n) Shift right
58 * void cpus_shift_left(dst, src, n) Shift left
59 *
60 * int first_cpu(mask) Number lowest set bit, or NR_CPUS
61 * int next_cpu(cpu, mask) Next cpu past 'cpu', or NR_CPUS
41df0d61 62 * int next_cpu_nr(cpu, mask) Next cpu past 'cpu', or nr_cpu_ids
1da177e4
LT
63 *
64 * cpumask_t cpumask_of_cpu(cpu) Return cpumask with bit 'cpu' set
65c01184
MT
65 *ifdef CONFIG_HAS_CPUMASK_OF_CPU
66 * cpumask_of_cpu_ptr_declare(v) Declares cpumask_t *v
67 * cpumask_of_cpu_ptr_next(v, cpu) Sets v = &cpumask_of_cpu_map[cpu]
68 * cpumask_of_cpu_ptr(v, cpu) Combines above two operations
69 *else
70 * cpumask_of_cpu_ptr_declare(v) Declares cpumask_t _v and *v = &_v
71 * cpumask_of_cpu_ptr_next(v, cpu) Sets _v = cpumask_of_cpu(cpu)
72 * cpumask_of_cpu_ptr(v, cpu) Combines above two operations
73 *endif
1da177e4
LT
74 * CPU_MASK_ALL Initializer - all bits set
75 * CPU_MASK_NONE Initializer - no bits set
76 * unsigned long *cpus_addr(mask) Array of unsigned long's in mask
77 *
78 * int cpumask_scnprintf(buf, len, mask) Format cpumask for printing
01a3ee2b 79 * int cpumask_parse_user(ubuf, ulen, mask) Parse ascii string as cpumask
1da177e4
LT
80 * int cpulist_scnprintf(buf, len, mask) Format cpumask as list for printing
81 * int cpulist_parse(buf, map) Parse ascii string as cpulist
fb5eeeee 82 * int cpu_remap(oldbit, old, new) newbit = map(old, new)(oldbit)
7ea931c9
PJ
83 * void cpus_remap(dst, src, old, new) *dst = map(old, new)(src)
84 * void cpus_onto(dst, orig, relmap) *dst = orig relative to relmap
85 * void cpus_fold(dst, orig, sz) dst bits = orig bits mod sz
1da177e4 86 *
41df0d61
MT
87 * for_each_cpu_mask(cpu, mask) for-loop cpu over mask using NR_CPUS
88 * for_each_cpu_mask_nr(cpu, mask) for-loop cpu over mask using nr_cpu_ids
1da177e4
LT
89 *
90 * int num_online_cpus() Number of online CPUs
91 * int num_possible_cpus() Number of all possible CPUs
92 * int num_present_cpus() Number of present CPUs
93 *
94 * int cpu_online(cpu) Is some cpu online?
95 * int cpu_possible(cpu) Is some cpu possible?
96 * int cpu_present(cpu) Is some cpu present (can schedule)?
97 *
98 * int any_online_cpu(mask) First online cpu in mask
99 *
631d6747 100 * for_each_possible_cpu(cpu) for-loop cpu over cpu_possible_map
1da177e4
LT
101 * for_each_online_cpu(cpu) for-loop cpu over cpu_online_map
102 * for_each_present_cpu(cpu) for-loop cpu over cpu_present_map
103 *
104 * Subtlety:
105 * 1) The 'type-checked' form of cpu_isset() causes gcc (3.3.2, anyway)
106 * to generate slightly worse code. Note for example the additional
107 * 40 lines of assembly code compiling the "for each possible cpu"
108 * loops buried in the disk_stat_read() macros calls when compiling
109 * drivers/block/genhd.c (arch i386, CONFIG_SMP=y). So use a simple
110 * one-line #define for cpu_isset(), instead of wrapping an inline
111 * inside a macro, the way we do the other calls.
112 */
113
114#include <linux/kernel.h>
115#include <linux/threads.h>
116#include <linux/bitmap.h>
1da177e4
LT
117
118typedef struct { DECLARE_BITMAP(bits, NR_CPUS); } cpumask_t;
119extern cpumask_t _unused_cpumask_arg_;
120
121#define cpu_set(cpu, dst) __cpu_set((cpu), &(dst))
122static inline void __cpu_set(int cpu, volatile cpumask_t *dstp)
123{
124 set_bit(cpu, dstp->bits);
125}
126
127#define cpu_clear(cpu, dst) __cpu_clear((cpu), &(dst))
128static inline void __cpu_clear(int cpu, volatile cpumask_t *dstp)
129{
130 clear_bit(cpu, dstp->bits);
131}
132
133#define cpus_setall(dst) __cpus_setall(&(dst), NR_CPUS)
134static inline void __cpus_setall(cpumask_t *dstp, int nbits)
135{
136 bitmap_fill(dstp->bits, nbits);
137}
138
139#define cpus_clear(dst) __cpus_clear(&(dst), NR_CPUS)
140static inline void __cpus_clear(cpumask_t *dstp, int nbits)
141{
142 bitmap_zero(dstp->bits, nbits);
143}
144
145/* No static inline type checking - see Subtlety (1) above. */
146#define cpu_isset(cpu, cpumask) test_bit((cpu), (cpumask).bits)
147
148#define cpu_test_and_set(cpu, cpumask) __cpu_test_and_set((cpu), &(cpumask))
149static inline int __cpu_test_and_set(int cpu, cpumask_t *addr)
150{
151 return test_and_set_bit(cpu, addr->bits);
152}
153
154#define cpus_and(dst, src1, src2) __cpus_and(&(dst), &(src1), &(src2), NR_CPUS)
155static inline void __cpus_and(cpumask_t *dstp, const cpumask_t *src1p,
156 const cpumask_t *src2p, int nbits)
157{
158 bitmap_and(dstp->bits, src1p->bits, src2p->bits, nbits);
159}
160
161#define cpus_or(dst, src1, src2) __cpus_or(&(dst), &(src1), &(src2), NR_CPUS)
162static inline void __cpus_or(cpumask_t *dstp, const cpumask_t *src1p,
163 const cpumask_t *src2p, int nbits)
164{
165 bitmap_or(dstp->bits, src1p->bits, src2p->bits, nbits);
166}
167
168#define cpus_xor(dst, src1, src2) __cpus_xor(&(dst), &(src1), &(src2), NR_CPUS)
169static inline void __cpus_xor(cpumask_t *dstp, const cpumask_t *src1p,
170 const cpumask_t *src2p, int nbits)
171{
172 bitmap_xor(dstp->bits, src1p->bits, src2p->bits, nbits);
173}
174
175#define cpus_andnot(dst, src1, src2) \
176 __cpus_andnot(&(dst), &(src1), &(src2), NR_CPUS)
177static inline void __cpus_andnot(cpumask_t *dstp, const cpumask_t *src1p,
178 const cpumask_t *src2p, int nbits)
179{
180 bitmap_andnot(dstp->bits, src1p->bits, src2p->bits, nbits);
181}
182
183#define cpus_complement(dst, src) __cpus_complement(&(dst), &(src), NR_CPUS)
184static inline void __cpus_complement(cpumask_t *dstp,
185 const cpumask_t *srcp, int nbits)
186{
187 bitmap_complement(dstp->bits, srcp->bits, nbits);
188}
189
190#define cpus_equal(src1, src2) __cpus_equal(&(src1), &(src2), NR_CPUS)
191static inline int __cpus_equal(const cpumask_t *src1p,
192 const cpumask_t *src2p, int nbits)
193{
194 return bitmap_equal(src1p->bits, src2p->bits, nbits);
195}
196
197#define cpus_intersects(src1, src2) __cpus_intersects(&(src1), &(src2), NR_CPUS)
198static inline int __cpus_intersects(const cpumask_t *src1p,
199 const cpumask_t *src2p, int nbits)
200{
201 return bitmap_intersects(src1p->bits, src2p->bits, nbits);
202}
203
204#define cpus_subset(src1, src2) __cpus_subset(&(src1), &(src2), NR_CPUS)
205static inline int __cpus_subset(const cpumask_t *src1p,
206 const cpumask_t *src2p, int nbits)
207{
208 return bitmap_subset(src1p->bits, src2p->bits, nbits);
209}
210
211#define cpus_empty(src) __cpus_empty(&(src), NR_CPUS)
212static inline int __cpus_empty(const cpumask_t *srcp, int nbits)
213{
214 return bitmap_empty(srcp->bits, nbits);
215}
216
217#define cpus_full(cpumask) __cpus_full(&(cpumask), NR_CPUS)
218static inline int __cpus_full(const cpumask_t *srcp, int nbits)
219{
220 return bitmap_full(srcp->bits, nbits);
221}
222
223#define cpus_weight(cpumask) __cpus_weight(&(cpumask), NR_CPUS)
224static inline int __cpus_weight(const cpumask_t *srcp, int nbits)
225{
226 return bitmap_weight(srcp->bits, nbits);
227}
228
229#define cpus_shift_right(dst, src, n) \
230 __cpus_shift_right(&(dst), &(src), (n), NR_CPUS)
231static inline void __cpus_shift_right(cpumask_t *dstp,
232 const cpumask_t *srcp, int n, int nbits)
233{
234 bitmap_shift_right(dstp->bits, srcp->bits, n, nbits);
235}
236
237#define cpus_shift_left(dst, src, n) \
238 __cpus_shift_left(&(dst), &(src), (n), NR_CPUS)
239static inline void __cpus_shift_left(cpumask_t *dstp,
240 const cpumask_t *srcp, int n, int nbits)
241{
242 bitmap_shift_left(dstp->bits, srcp->bits, n, nbits);
243}
244
1da177e4 245
9f0e8d04
MT
246#ifdef CONFIG_HAVE_CPUMASK_OF_CPU_MAP
247extern cpumask_t *cpumask_of_cpu_map;
65c01184
MT
248#define cpumask_of_cpu(cpu) (cpumask_of_cpu_map[cpu])
249#define cpumask_of_cpu_ptr(v, cpu) \
250 const cpumask_t *v = &cpumask_of_cpu(cpu)
251#define cpumask_of_cpu_ptr_declare(v) \
252 const cpumask_t *v
253#define cpumask_of_cpu_ptr_next(v, cpu) \
254 v = &cpumask_of_cpu(cpu)
9f0e8d04 255#else
1da177e4 256#define cpumask_of_cpu(cpu) \
65c01184 257({ \
1da177e4
LT
258 typeof(_unused_cpumask_arg_) m; \
259 if (sizeof(m) == sizeof(unsigned long)) { \
260 m.bits[0] = 1UL<<(cpu); \
261 } else { \
262 cpus_clear(m); \
263 cpu_set((cpu), m); \
264 } \
65c01184
MT
265 m; \
266})
267#define cpumask_of_cpu_ptr(v, cpu) \
268 cpumask_t _##v = cpumask_of_cpu(cpu); \
269 const cpumask_t *v = &_##v
270#define cpumask_of_cpu_ptr_declare(v) \
271 cpumask_t _##v; \
272 const cpumask_t *v = &_##v
273#define cpumask_of_cpu_ptr_next(v, cpu) \
274 _##v = cpumask_of_cpu(cpu)
9f0e8d04 275#endif
1da177e4
LT
276
277#define CPU_MASK_LAST_WORD BITMAP_LAST_WORD_MASK(NR_CPUS)
278
279#if NR_CPUS <= BITS_PER_LONG
280
281#define CPU_MASK_ALL \
282(cpumask_t) { { \
283 [BITS_TO_LONGS(NR_CPUS)-1] = CPU_MASK_LAST_WORD \
284} }
285
321a8e9d
MT
286#define CPU_MASK_ALL_PTR (&CPU_MASK_ALL)
287
1da177e4
LT
288#else
289
290#define CPU_MASK_ALL \
291(cpumask_t) { { \
292 [0 ... BITS_TO_LONGS(NR_CPUS)-2] = ~0UL, \
293 [BITS_TO_LONGS(NR_CPUS)-1] = CPU_MASK_LAST_WORD \
294} }
295
321a8e9d
MT
296/* cpu_mask_all is in init/main.c */
297extern cpumask_t cpu_mask_all;
298#define CPU_MASK_ALL_PTR (&cpu_mask_all)
299
1da177e4
LT
300#endif
301
302#define CPU_MASK_NONE \
303(cpumask_t) { { \
304 [0 ... BITS_TO_LONGS(NR_CPUS)-1] = 0UL \
305} }
306
307#define CPU_MASK_CPU0 \
308(cpumask_t) { { \
309 [0] = 1UL \
310} }
311
312#define cpus_addr(src) ((src).bits)
313
314#define cpumask_scnprintf(buf, len, src) \
315 __cpumask_scnprintf((buf), (len), &(src), NR_CPUS)
316static inline int __cpumask_scnprintf(char *buf, int len,
317 const cpumask_t *srcp, int nbits)
318{
319 return bitmap_scnprintf(buf, len, srcp->bits, nbits);
320}
321
01a3ee2b
RC
322#define cpumask_parse_user(ubuf, ulen, dst) \
323 __cpumask_parse_user((ubuf), (ulen), &(dst), NR_CPUS)
324static inline int __cpumask_parse_user(const char __user *buf, int len,
1da177e4
LT
325 cpumask_t *dstp, int nbits)
326{
01a3ee2b 327 return bitmap_parse_user(buf, len, dstp->bits, nbits);
1da177e4
LT
328}
329
330#define cpulist_scnprintf(buf, len, src) \
331 __cpulist_scnprintf((buf), (len), &(src), NR_CPUS)
332static inline int __cpulist_scnprintf(char *buf, int len,
333 const cpumask_t *srcp, int nbits)
334{
335 return bitmap_scnlistprintf(buf, len, srcp->bits, nbits);
336}
337
338#define cpulist_parse(buf, dst) __cpulist_parse((buf), &(dst), NR_CPUS)
339static inline int __cpulist_parse(const char *buf, cpumask_t *dstp, int nbits)
340{
341 return bitmap_parselist(buf, dstp->bits, nbits);
342}
343
fb5eeeee
PJ
344#define cpu_remap(oldbit, old, new) \
345 __cpu_remap((oldbit), &(old), &(new), NR_CPUS)
346static inline int __cpu_remap(int oldbit,
347 const cpumask_t *oldp, const cpumask_t *newp, int nbits)
348{
349 return bitmap_bitremap(oldbit, oldp->bits, newp->bits, nbits);
350}
351
352#define cpus_remap(dst, src, old, new) \
353 __cpus_remap(&(dst), &(src), &(old), &(new), NR_CPUS)
354static inline void __cpus_remap(cpumask_t *dstp, const cpumask_t *srcp,
355 const cpumask_t *oldp, const cpumask_t *newp, int nbits)
356{
357 bitmap_remap(dstp->bits, srcp->bits, oldp->bits, newp->bits, nbits);
358}
359
7ea931c9
PJ
360#define cpus_onto(dst, orig, relmap) \
361 __cpus_onto(&(dst), &(orig), &(relmap), NR_CPUS)
362static inline void __cpus_onto(cpumask_t *dstp, const cpumask_t *origp,
363 const cpumask_t *relmapp, int nbits)
364{
365 bitmap_onto(dstp->bits, origp->bits, relmapp->bits, nbits);
366}
367
368#define cpus_fold(dst, orig, sz) \
369 __cpus_fold(&(dst), &(orig), sz, NR_CPUS)
370static inline void __cpus_fold(cpumask_t *dstp, const cpumask_t *origp,
371 int sz, int nbits)
372{
373 bitmap_fold(dstp->bits, origp->bits, sz, nbits);
374}
375
41df0d61
MT
376#if NR_CPUS == 1
377
378#define nr_cpu_ids 1
379#define first_cpu(src) ({ (void)(src); 0; })
380#define next_cpu(n, src) ({ (void)(src); 1; })
381#define any_online_cpu(mask) 0
382#define for_each_cpu_mask(cpu, mask) \
383 for ((cpu) = 0; (cpu) < 1; (cpu)++, (void)mask)
384
385#else /* NR_CPUS > 1 */
386
387extern int nr_cpu_ids;
388int __first_cpu(const cpumask_t *srcp);
389int __next_cpu(int n, const cpumask_t *srcp);
390int __any_online_cpu(const cpumask_t *mask);
391
392#define first_cpu(src) __first_cpu(&(src))
393#define next_cpu(n, src) __next_cpu((n), &(src))
394#define any_online_cpu(mask) __any_online_cpu(&(mask))
7baac8b9
AH
395#define for_each_cpu_mask(cpu, mask) \
396 for ((cpu) = -1; \
397 (cpu) = next_cpu((cpu), (mask)), \
398 (cpu) < NR_CPUS; )
41df0d61
MT
399#endif
400
401#if NR_CPUS <= 64
402
403#define next_cpu_nr(n, src) next_cpu(n, src)
404#define cpus_weight_nr(cpumask) cpus_weight(cpumask)
405#define for_each_cpu_mask_nr(cpu, mask) for_each_cpu_mask(cpu, mask)
406
407#else /* NR_CPUS > 64 */
408
409int __next_cpu_nr(int n, const cpumask_t *srcp);
410#define next_cpu_nr(n, src) __next_cpu_nr((n), &(src))
411#define cpus_weight_nr(cpumask) __cpus_weight(&(cpumask), nr_cpu_ids)
7baac8b9
AH
412#define for_each_cpu_mask_nr(cpu, mask) \
413 for ((cpu) = -1; \
414 (cpu) = next_cpu_nr((cpu), (mask)), \
415 (cpu) < nr_cpu_ids; )
41df0d61
MT
416
417#endif /* NR_CPUS > 64 */
1da177e4
LT
418
419/*
420 * The following particular system cpumasks and operations manage
421 * possible, present and online cpus. Each of them is a fixed size
422 * bitmap of size NR_CPUS.
423 *
424 * #ifdef CONFIG_HOTPLUG_CPU
7a8ef1cb 425 * cpu_possible_map - has bit 'cpu' set iff cpu is populatable
1da177e4
LT
426 * cpu_present_map - has bit 'cpu' set iff cpu is populated
427 * cpu_online_map - has bit 'cpu' set iff cpu available to scheduler
428 * #else
429 * cpu_possible_map - has bit 'cpu' set iff cpu is populated
430 * cpu_present_map - copy of cpu_possible_map
431 * cpu_online_map - has bit 'cpu' set iff cpu available to scheduler
432 * #endif
433 *
434 * In either case, NR_CPUS is fixed at compile time, as the static
435 * size of these bitmaps. The cpu_possible_map is fixed at boot
436 * time, as the set of CPU id's that it is possible might ever
437 * be plugged in at anytime during the life of that system boot.
438 * The cpu_present_map is dynamic(*), representing which CPUs
439 * are currently plugged in. And cpu_online_map is the dynamic
440 * subset of cpu_present_map, indicating those CPUs available
441 * for scheduling.
442 *
443 * If HOTPLUG is enabled, then cpu_possible_map is forced to have
444 * all NR_CPUS bits set, otherwise it is just the set of CPUs that
445 * ACPI reports present at boot.
446 *
447 * If HOTPLUG is enabled, then cpu_present_map varies dynamically,
448 * depending on what ACPI reports as currently plugged in, otherwise
449 * cpu_present_map is just a copy of cpu_possible_map.
450 *
451 * (*) Well, cpu_present_map is dynamic in the hotplug case. If not
452 * hotplug, it's a copy of cpu_possible_map, hence fixed at boot.
453 *
454 * Subtleties:
455 * 1) UP arch's (NR_CPUS == 1, CONFIG_SMP not defined) hardcode
456 * assumption that their single CPU is online. The UP
457 * cpu_{online,possible,present}_maps are placebos. Changing them
458 * will have no useful affect on the following num_*_cpus()
459 * and cpu_*() macros in the UP case. This ugliness is a UP
460 * optimization - don't waste any instructions or memory references
461 * asking if you're online or how many CPUs there are if there is
462 * only one CPU.
463 * 2) Most SMP arch's #define some of these maps to be some
464 * other map specific to that arch. Therefore, the following
465 * must be #define macros, not inlines. To see why, examine
466 * the assembly code produced by the following. Note that
467 * set1() writes phys_x_map, but set2() writes x_map:
468 * int x_map, phys_x_map;
469 * #define set1(a) x_map = a
470 * inline void set2(int a) { x_map = a; }
471 * #define x_map phys_x_map
472 * main(){ set1(3); set2(5); }
473 */
474
475extern cpumask_t cpu_possible_map;
476extern cpumask_t cpu_online_map;
477extern cpumask_t cpu_present_map;
478
479#if NR_CPUS > 1
41df0d61
MT
480#define num_online_cpus() cpus_weight_nr(cpu_online_map)
481#define num_possible_cpus() cpus_weight_nr(cpu_possible_map)
482#define num_present_cpus() cpus_weight_nr(cpu_present_map)
1da177e4
LT
483#define cpu_online(cpu) cpu_isset((cpu), cpu_online_map)
484#define cpu_possible(cpu) cpu_isset((cpu), cpu_possible_map)
485#define cpu_present(cpu) cpu_isset((cpu), cpu_present_map)
486#else
487#define num_online_cpus() 1
488#define num_possible_cpus() 1
489#define num_present_cpus() 1
490#define cpu_online(cpu) ((cpu) == 0)
491#define cpu_possible(cpu) ((cpu) == 0)
492#define cpu_present(cpu) ((cpu) == 0)
493#endif
494
a263898f
IM
495#define cpu_is_offline(cpu) unlikely(!cpu_online(cpu))
496
41df0d61
MT
497#define for_each_possible_cpu(cpu) for_each_cpu_mask_nr((cpu), cpu_possible_map)
498#define for_each_online_cpu(cpu) for_each_cpu_mask_nr((cpu), cpu_online_map)
499#define for_each_present_cpu(cpu) for_each_cpu_mask_nr((cpu), cpu_present_map)
1da177e4
LT
500
501#endif /* __LINUX_CPUMASK_H */