1/* SPDX-License-Identifier: GPL-2.0 */
2#ifndef __LINUX_CPUMASK_H
3#define __LINUX_CPUMASK_H
4
5/*
6 * Cpumasks provide a bitmap suitable for representing the
7 * set of CPUs in a system, one bit position per CPU number.  In general,
8 * only nr_cpu_ids (<= NR_CPUS) bits are valid.
9 */
10#include <linux/cleanup.h>
11#include <linux/kernel.h>
12#include <linux/threads.h>
13#include <linux/bitmap.h>
14#include <linux/atomic.h>
15#include <linux/bug.h>
16#include <linux/gfp_types.h>
17#include <linux/numa.h>
18
19/* Don't assign or return these: may not be this big! */
20typedef struct cpumask { DECLARE_BITMAP(bits, NR_CPUS); } cpumask_t;
21
22/**
23 * cpumask_bits - get the bits in a cpumask
24 * @maskp: the struct cpumask *
25 *
26 * You should only assume nr_cpu_ids bits of this mask are valid.  This is
27 * a macro so it's const-correct.
28 */
29#define cpumask_bits(maskp) ((maskp)->bits)
30
31/**
32 * cpumask_pr_args - printf args to output a cpumask
33 * @maskp: cpumask to be printed
34 *
35 * Can be used to provide arguments for '%*pb[l]' when printing a cpumask.
36 */
37#define cpumask_pr_args(maskp)		nr_cpu_ids, cpumask_bits(maskp)
38
39#if (NR_CPUS == 1) || defined(CONFIG_FORCE_NR_CPUS)
40#define nr_cpu_ids ((unsigned int)NR_CPUS)
41#else
42extern unsigned int nr_cpu_ids;
43#endif
44
45static inline void set_nr_cpu_ids(unsigned int nr)
46{
47#if (NR_CPUS == 1) || defined(CONFIG_FORCE_NR_CPUS)
48	WARN_ON(nr != nr_cpu_ids);
49#else
50	nr_cpu_ids = nr;
51#endif
52}
53
54/*
55 * We have several different "preferred sizes" for the cpumask
56 * operations, depending on operation.
57 *
58 * For example, the bitmap scanning and operating operations have
59 * optimized routines that work for the single-word case, but only when
60 * the size is constant. So if NR_CPUS fits in one single word, we are
61 * better off using that small constant, in order to trigger the
62 * optimized bit finding. That is 'small_cpumask_size'.
63 *
64 * The clearing and copying operations will similarly perform better
65 * with a constant size, but we limit that size arbitrarily to four
66 * words. We call this 'large_cpumask_size'.
67 *
68 * Finally, some operations just want the exact limit, either because
69 * they set bits or just don't have any faster fixed-sized versions. We
70 * call this just 'nr_cpumask_bits'.
71 *
72 * Note that these optional constants are always guaranteed to be at
73 * least as big as 'nr_cpu_ids' itself is, and all our cpumask
74 * allocations are at least that size (see cpumask_size()). The
75 * optimization comes from being able to potentially use a compile-time
76 * constant instead of a run-time generated exact number of CPUs.
77 */
78#if NR_CPUS <= BITS_PER_LONG
79  #define small_cpumask_bits ((unsigned int)NR_CPUS)
80  #define large_cpumask_bits ((unsigned int)NR_CPUS)
81#elif NR_CPUS <= 4*BITS_PER_LONG
82  #define small_cpumask_bits nr_cpu_ids
83  #define large_cpumask_bits ((unsigned int)NR_CPUS)
84#else
85  #define small_cpumask_bits nr_cpu_ids
86  #define large_cpumask_bits nr_cpu_ids
87#endif
88#define nr_cpumask_bits nr_cpu_ids
89
90/*
91 * The following particular system cpumasks and operations manage
92 * possible, present, active and online cpus.
93 *
94 *     cpu_possible_mask- has bit 'cpu' set iff cpu is populatable
95 *     cpu_present_mask - has bit 'cpu' set iff cpu is populated
96 *     cpu_online_mask  - has bit 'cpu' set iff cpu available to scheduler
97 *     cpu_active_mask  - has bit 'cpu' set iff cpu available to migration
98 *
99 *  If !CONFIG_HOTPLUG_CPU, present == possible, and active == online.
100 *
101 *  The cpu_possible_mask is fixed at boot time, as the set of CPU IDs
102 *  that it is possible might ever be plugged in at anytime during the
103 *  life of that system boot.  The cpu_present_mask is dynamic(*),
104 *  representing which CPUs are currently plugged in.  And
105 *  cpu_online_mask is the dynamic subset of cpu_present_mask,
106 *  indicating those CPUs available for scheduling.
107 *
108 *  If HOTPLUG is enabled, then cpu_present_mask varies dynamically,
109 *  depending on what ACPI reports as currently plugged in, otherwise
110 *  cpu_present_mask is just a copy of cpu_possible_mask.
111 *
112 *  (*) Well, cpu_present_mask is dynamic in the hotplug case.  If not
113 *      hotplug, it's a copy of cpu_possible_mask, hence fixed at boot.
114 *
115 * Subtleties:
116 * 1) UP ARCHes (NR_CPUS == 1, CONFIG_SMP not defined) hardcode
117 *    assumption that their single CPU is online.  The UP
118 *    cpu_{online,possible,present}_masks are placebos.  Changing them
119 *    will have no useful affect on the following num_*_cpus()
120 *    and cpu_*() macros in the UP case.  This ugliness is a UP
121 *    optimization - don't waste any instructions or memory references
122 *    asking if you're online or how many CPUs there are if there is
123 *    only one CPU.
124 */
125
126extern struct cpumask __cpu_possible_mask;
127extern struct cpumask __cpu_online_mask;
128extern struct cpumask __cpu_present_mask;
129extern struct cpumask __cpu_active_mask;
130extern struct cpumask __cpu_dying_mask;
131#define cpu_possible_mask ((const struct cpumask *)&__cpu_possible_mask)
132#define cpu_online_mask   ((const struct cpumask *)&__cpu_online_mask)
133#define cpu_present_mask  ((const struct cpumask *)&__cpu_present_mask)
134#define cpu_active_mask   ((const struct cpumask *)&__cpu_active_mask)
135#define cpu_dying_mask    ((const struct cpumask *)&__cpu_dying_mask)
136
137extern atomic_t __num_online_cpus;
138
139extern cpumask_t cpus_booted_once_mask;
140
141static __always_inline void cpu_max_bits_warn(unsigned int cpu, unsigned int bits)
142{
143#ifdef CONFIG_DEBUG_PER_CPU_MAPS
144	WARN_ON_ONCE(cpu >= bits);
145#endif /* CONFIG_DEBUG_PER_CPU_MAPS */
146}
147
148/* verify cpu argument to cpumask_* operators */
149static __always_inline unsigned int cpumask_check(unsigned int cpu)
150{
151	cpu_max_bits_warn(cpu, small_cpumask_bits);
152	return cpu;
153}
154
155/**
156 * cpumask_first - get the first cpu in a cpumask
157 * @srcp: the cpumask pointer
158 *
159 * Return: >= nr_cpu_ids if no cpus set.
160 */
161static inline unsigned int cpumask_first(const struct cpumask *srcp)
162{
163	return find_first_bit(cpumask_bits(srcp), small_cpumask_bits);
164}
165
166/**
167 * cpumask_first_zero - get the first unset cpu in a cpumask
168 * @srcp: the cpumask pointer
169 *
170 * Return: >= nr_cpu_ids if all cpus are set.
171 */
172static inline unsigned int cpumask_first_zero(const struct cpumask *srcp)
173{
174	return find_first_zero_bit(cpumask_bits(srcp), small_cpumask_bits);
175}
176
177/**
178 * cpumask_first_and - return the first cpu from *srcp1 & *srcp2
179 * @srcp1: the first input
180 * @srcp2: the second input
181 *
182 * Return: >= nr_cpu_ids if no cpus set in both.  See also cpumask_next_and().
183 */
184static inline
185unsigned int cpumask_first_and(const struct cpumask *srcp1, const struct cpumask *srcp2)
186{
187	return find_first_and_bit(cpumask_bits(srcp1), cpumask_bits(srcp2), small_cpumask_bits);
188}
189
190/**
191 * cpumask_last - get the last CPU in a cpumask
192 * @srcp:	- the cpumask pointer
193 *
194 * Return:	>= nr_cpumask_bits if no CPUs set.
195 */
196static inline unsigned int cpumask_last(const struct cpumask *srcp)
197{
198	return find_last_bit(cpumask_bits(srcp), small_cpumask_bits);
199}
200
201/**
202 * cpumask_next - get the next cpu in a cpumask
203 * @n: the cpu prior to the place to search (i.e. return will be > @n)
204 * @srcp: the cpumask pointer
205 *
206 * Return: >= nr_cpu_ids if no further cpus set.
207 */
208static inline
209unsigned int cpumask_next(int n, const struct cpumask *srcp)
210{
211	/* -1 is a legal arg here. */
212	if (n != -1)
213		cpumask_check(n);
214	return find_next_bit(cpumask_bits(srcp), small_cpumask_bits, n + 1);
215}
216
217/**
218 * cpumask_next_zero - get the next unset cpu in a cpumask
219 * @n: the cpu prior to the place to search (i.e. return will be > @n)
220 * @srcp: the cpumask pointer
221 *
222 * Return: >= nr_cpu_ids if no further cpus unset.
223 */
224static inline unsigned int cpumask_next_zero(int n, const struct cpumask *srcp)
225{
226	/* -1 is a legal arg here. */
227	if (n != -1)
228		cpumask_check(n);
229	return find_next_zero_bit(cpumask_bits(srcp), small_cpumask_bits, n+1);
230}
231
232#if NR_CPUS == 1
233/* Uniprocessor: there is only one valid CPU */
234static inline unsigned int cpumask_local_spread(unsigned int i, int node)
235{
236	return 0;
237}
238
239static inline unsigned int cpumask_any_and_distribute(const struct cpumask *src1p,
240						      const struct cpumask *src2p)
241{
242	return cpumask_first_and(src1p, src2p);
243}
244
245static inline unsigned int cpumask_any_distribute(const struct cpumask *srcp)
246{
247	return cpumask_first(srcp);
248}
249#else
250unsigned int cpumask_local_spread(unsigned int i, int node);
251unsigned int cpumask_any_and_distribute(const struct cpumask *src1p,
252			       const struct cpumask *src2p);
253unsigned int cpumask_any_distribute(const struct cpumask *srcp);
254#endif /* NR_CPUS */
255
256/**
257 * cpumask_next_and - get the next cpu in *src1p & *src2p
258 * @n: the cpu prior to the place to search (i.e. return will be > @n)
259 * @src1p: the first cpumask pointer
260 * @src2p: the second cpumask pointer
261 *
262 * Return: >= nr_cpu_ids if no further cpus set in both.
263 */
264static inline
265unsigned int cpumask_next_and(int n, const struct cpumask *src1p,
266		     const struct cpumask *src2p)
267{
268	/* -1 is a legal arg here. */
269	if (n != -1)
270		cpumask_check(n);
271	return find_next_and_bit(cpumask_bits(src1p), cpumask_bits(src2p),
272		small_cpumask_bits, n + 1);
273}
274
275/**
276 * for_each_cpu - iterate over every cpu in a mask
277 * @cpu: the (optionally unsigned) integer iterator
278 * @mask: the cpumask pointer
279 *
280 * After the loop, cpu is >= nr_cpu_ids.
281 */
282#define for_each_cpu(cpu, mask)				\
283	for_each_set_bit(cpu, cpumask_bits(mask), small_cpumask_bits)
284
285#if NR_CPUS == 1
286static inline
287unsigned int cpumask_next_wrap(int n, const struct cpumask *mask, int start, bool wrap)
288{
289	cpumask_check(start);
290	if (n != -1)
291		cpumask_check(n);
292
293	/*
294	 * Return the first available CPU when wrapping, or when starting before cpu0,
295	 * since there is only one valid option.
296	 */
297	if (wrap && n >= 0)
298		return nr_cpumask_bits;
299
300	return cpumask_first(mask);
301}
302#else
303unsigned int __pure cpumask_next_wrap(int n, const struct cpumask *mask, int start, bool wrap);
304#endif
305
306/**
307 * for_each_cpu_wrap - iterate over every cpu in a mask, starting at a specified location
308 * @cpu: the (optionally unsigned) integer iterator
309 * @mask: the cpumask pointer
310 * @start: the start location
311 *
312 * The implementation does not assume any bit in @mask is set (including @start).
313 *
314 * After the loop, cpu is >= nr_cpu_ids.
315 */
316#define for_each_cpu_wrap(cpu, mask, start)				\
317	for_each_set_bit_wrap(cpu, cpumask_bits(mask), small_cpumask_bits, start)
318
319/**
320 * for_each_cpu_and - iterate over every cpu in both masks
321 * @cpu: the (optionally unsigned) integer iterator
322 * @mask1: the first cpumask pointer
323 * @mask2: the second cpumask pointer
324 *
325 * This saves a temporary CPU mask in many places.  It is equivalent to:
326 *	struct cpumask tmp;
327 *	cpumask_and(&tmp, &mask1, &mask2);
328 *	for_each_cpu(cpu, &tmp)
329 *		...
330 *
331 * After the loop, cpu is >= nr_cpu_ids.
332 */
333#define for_each_cpu_and(cpu, mask1, mask2)				\
334	for_each_and_bit(cpu, cpumask_bits(mask1), cpumask_bits(mask2), small_cpumask_bits)
335
336/**
337 * for_each_cpu_andnot - iterate over every cpu present in one mask, excluding
338 *			 those present in another.
339 * @cpu: the (optionally unsigned) integer iterator
340 * @mask1: the first cpumask pointer
341 * @mask2: the second cpumask pointer
342 *
343 * This saves a temporary CPU mask in many places.  It is equivalent to:
344 *	struct cpumask tmp;
345 *	cpumask_andnot(&tmp, &mask1, &mask2);
346 *	for_each_cpu(cpu, &tmp)
347 *		...
348 *
349 * After the loop, cpu is >= nr_cpu_ids.
350 */
351#define for_each_cpu_andnot(cpu, mask1, mask2)				\
352	for_each_andnot_bit(cpu, cpumask_bits(mask1), cpumask_bits(mask2), small_cpumask_bits)
353
354/**
355 * for_each_cpu_or - iterate over every cpu present in either mask
356 * @cpu: the (optionally unsigned) integer iterator
357 * @mask1: the first cpumask pointer
358 * @mask2: the second cpumask pointer
359 *
360 * This saves a temporary CPU mask in many places.  It is equivalent to:
361 *	struct cpumask tmp;
362 *	cpumask_or(&tmp, &mask1, &mask2);
363 *	for_each_cpu(cpu, &tmp)
364 *		...
365 *
366 * After the loop, cpu is >= nr_cpu_ids.
367 */
368#define for_each_cpu_or(cpu, mask1, mask2)				\
369	for_each_or_bit(cpu, cpumask_bits(mask1), cpumask_bits(mask2), small_cpumask_bits)
370
371/**
372 * cpumask_any_but - return a "random" in a cpumask, but not this one.
373 * @mask: the cpumask to search
374 * @cpu: the cpu to ignore.
375 *
376 * Often used to find any cpu but smp_processor_id() in a mask.
377 * Return: >= nr_cpu_ids if no cpus set.
378 */
379static inline
380unsigned int cpumask_any_but(const struct cpumask *mask, unsigned int cpu)
381{
382	unsigned int i;
383
384	cpumask_check(cpu);
385	for_each_cpu(i, mask)
386		if (i != cpu)
387			break;
388	return i;
389}
390
391/**
392 * cpumask_nth - get the Nth cpu in a cpumask
393 * @srcp: the cpumask pointer
394 * @cpu: the Nth cpu to find, starting from 0
395 *
396 * Return: >= nr_cpu_ids if such cpu doesn't exist.
397 */
398static inline unsigned int cpumask_nth(unsigned int cpu, const struct cpumask *srcp)
399{
400	return find_nth_bit(cpumask_bits(srcp), small_cpumask_bits, cpumask_check(cpu));
401}
402
403/**
404 * cpumask_nth_and - get the Nth cpu in 2 cpumasks
405 * @srcp1: the cpumask pointer
406 * @srcp2: the cpumask pointer
407 * @cpu: the Nth cpu to find, starting from 0
408 *
409 * Return: >= nr_cpu_ids if such cpu doesn't exist.
410 */
411static inline
412unsigned int cpumask_nth_and(unsigned int cpu, const struct cpumask *srcp1,
413							const struct cpumask *srcp2)
414{
415	return find_nth_and_bit(cpumask_bits(srcp1), cpumask_bits(srcp2),
416				small_cpumask_bits, cpumask_check(cpu));
417}
418
419/**
420 * cpumask_nth_andnot - get the Nth cpu set in 1st cpumask, and clear in 2nd.
421 * @srcp1: the cpumask pointer
422 * @srcp2: the cpumask pointer
423 * @cpu: the Nth cpu to find, starting from 0
424 *
425 * Return: >= nr_cpu_ids if such cpu doesn't exist.
426 */
427static inline
428unsigned int cpumask_nth_andnot(unsigned int cpu, const struct cpumask *srcp1,
429							const struct cpumask *srcp2)
430{
431	return find_nth_andnot_bit(cpumask_bits(srcp1), cpumask_bits(srcp2),
432				small_cpumask_bits, cpumask_check(cpu));
433}
434
435/**
436 * cpumask_nth_and_andnot - get the Nth cpu set in 1st and 2nd cpumask, and clear in 3rd.
437 * @srcp1: the cpumask pointer
438 * @srcp2: the cpumask pointer
439 * @srcp3: the cpumask pointer
440 * @cpu: the Nth cpu to find, starting from 0
441 *
442 * Return: >= nr_cpu_ids if such cpu doesn't exist.
443 */
444static __always_inline
445unsigned int cpumask_nth_and_andnot(unsigned int cpu, const struct cpumask *srcp1,
446							const struct cpumask *srcp2,
447							const struct cpumask *srcp3)
448{
449	return find_nth_and_andnot_bit(cpumask_bits(srcp1),
450					cpumask_bits(srcp2),
451					cpumask_bits(srcp3),
452					small_cpumask_bits, cpumask_check(cpu));
453}
454
455#define CPU_BITS_NONE						\
456{								\
457	[0 ... BITS_TO_LONGS(NR_CPUS)-1] = 0UL			\
458}
459
460#define CPU_BITS_CPU0						\
461{								\
462	[0] =  1UL						\
463}
464
465/**
466 * cpumask_set_cpu - set a cpu in a cpumask
467 * @cpu: cpu number (< nr_cpu_ids)
468 * @dstp: the cpumask pointer
469 */
470static __always_inline void cpumask_set_cpu(unsigned int cpu, struct cpumask *dstp)
471{
472	set_bit(cpumask_check(cpu), cpumask_bits(dstp));
473}
474
475static __always_inline void __cpumask_set_cpu(unsigned int cpu, struct cpumask *dstp)
476{
477	__set_bit(cpumask_check(cpu), cpumask_bits(dstp));
478}
479
480
481/**
482 * cpumask_clear_cpu - clear a cpu in a cpumask
483 * @cpu: cpu number (< nr_cpu_ids)
484 * @dstp: the cpumask pointer
485 */
486static __always_inline void cpumask_clear_cpu(int cpu, struct cpumask *dstp)
487{
488	clear_bit(cpumask_check(cpu), cpumask_bits(dstp));
489}
490
491static __always_inline void __cpumask_clear_cpu(int cpu, struct cpumask *dstp)
492{
493	__clear_bit(cpumask_check(cpu), cpumask_bits(dstp));
494}
495
496/**
497 * cpumask_test_cpu - test for a cpu in a cpumask
498 * @cpu: cpu number (< nr_cpu_ids)
499 * @cpumask: the cpumask pointer
500 *
501 * Return: true if @cpu is set in @cpumask, else returns false
502 */
503static __always_inline bool cpumask_test_cpu(int cpu, const struct cpumask *cpumask)
504{
505	return test_bit(cpumask_check(cpu), cpumask_bits((cpumask)));
506}
507
508/**
509 * cpumask_test_and_set_cpu - atomically test and set a cpu in a cpumask
510 * @cpu: cpu number (< nr_cpu_ids)
511 * @cpumask: the cpumask pointer
512 *
513 * test_and_set_bit wrapper for cpumasks.
514 *
515 * Return: true if @cpu is set in old bitmap of @cpumask, else returns false
516 */
517static __always_inline bool cpumask_test_and_set_cpu(int cpu, struct cpumask *cpumask)
518{
519	return test_and_set_bit(cpumask_check(cpu), cpumask_bits(cpumask));
520}
521
522/**
523 * cpumask_test_and_clear_cpu - atomically test and clear a cpu in a cpumask
524 * @cpu: cpu number (< nr_cpu_ids)
525 * @cpumask: the cpumask pointer
526 *
527 * test_and_clear_bit wrapper for cpumasks.
528 *
529 * Return: true if @cpu is set in old bitmap of @cpumask, else returns false
530 */
531static __always_inline bool cpumask_test_and_clear_cpu(int cpu, struct cpumask *cpumask)
532{
533	return test_and_clear_bit(cpumask_check(cpu), cpumask_bits(cpumask));
534}
535
536/**
537 * cpumask_setall - set all cpus (< nr_cpu_ids) in a cpumask
538 * @dstp: the cpumask pointer
539 */
540static inline void cpumask_setall(struct cpumask *dstp)
541{
542	if (small_const_nbits(small_cpumask_bits)) {
543		cpumask_bits(dstp)[0] = BITMAP_LAST_WORD_MASK(nr_cpumask_bits);
544		return;
545	}
546	bitmap_fill(cpumask_bits(dstp), nr_cpumask_bits);
547}
548
549/**
550 * cpumask_clear - clear all cpus (< nr_cpu_ids) in a cpumask
551 * @dstp: the cpumask pointer
552 */
553static inline void cpumask_clear(struct cpumask *dstp)
554{
555	bitmap_zero(cpumask_bits(dstp), large_cpumask_bits);
556}
557
558/**
559 * cpumask_and - *dstp = *src1p & *src2p
560 * @dstp: the cpumask result
561 * @src1p: the first input
562 * @src2p: the second input
563 *
564 * Return: false if *@dstp is empty, else returns true
565 */
566static inline bool cpumask_and(struct cpumask *dstp,
567			       const struct cpumask *src1p,
568			       const struct cpumask *src2p)
569{
570	return bitmap_and(cpumask_bits(dstp), cpumask_bits(src1p),
571				       cpumask_bits(src2p), small_cpumask_bits);
572}
573
574/**
575 * cpumask_or - *dstp = *src1p | *src2p
576 * @dstp: the cpumask result
577 * @src1p: the first input
578 * @src2p: the second input
579 */
580static inline void cpumask_or(struct cpumask *dstp, const struct cpumask *src1p,
581			      const struct cpumask *src2p)
582{
583	bitmap_or(cpumask_bits(dstp), cpumask_bits(src1p),
584				      cpumask_bits(src2p), small_cpumask_bits);
585}
586
587/**
588 * cpumask_xor - *dstp = *src1p ^ *src2p
589 * @dstp: the cpumask result
590 * @src1p: the first input
591 * @src2p: the second input
592 */
593static inline void cpumask_xor(struct cpumask *dstp,
594			       const struct cpumask *src1p,
595			       const struct cpumask *src2p)
596{
597	bitmap_xor(cpumask_bits(dstp), cpumask_bits(src1p),
598				       cpumask_bits(src2p), small_cpumask_bits);
599}
600
601/**
602 * cpumask_andnot - *dstp = *src1p & ~*src2p
603 * @dstp: the cpumask result
604 * @src1p: the first input
605 * @src2p: the second input
606 *
607 * Return: false if *@dstp is empty, else returns true
608 */
609static inline bool cpumask_andnot(struct cpumask *dstp,
610				  const struct cpumask *src1p,
611				  const struct cpumask *src2p)
612{
613	return bitmap_andnot(cpumask_bits(dstp), cpumask_bits(src1p),
614					  cpumask_bits(src2p), small_cpumask_bits);
615}
616
617/**
618 * cpumask_equal - *src1p == *src2p
619 * @src1p: the first input
620 * @src2p: the second input
621 *
622 * Return: true if the cpumasks are equal, false if not
623 */
624static inline bool cpumask_equal(const struct cpumask *src1p,
625				const struct cpumask *src2p)
626{
627	return bitmap_equal(cpumask_bits(src1p), cpumask_bits(src2p),
628						 small_cpumask_bits);
629}
630
631/**
632 * cpumask_or_equal - *src1p | *src2p == *src3p
633 * @src1p: the first input
634 * @src2p: the second input
635 * @src3p: the third input
636 *
637 * Return: true if first cpumask ORed with second cpumask == third cpumask,
638 *	   otherwise false
639 */
640static inline bool cpumask_or_equal(const struct cpumask *src1p,
641				    const struct cpumask *src2p,
642				    const struct cpumask *src3p)
643{
644	return bitmap_or_equal(cpumask_bits(src1p), cpumask_bits(src2p),
645			       cpumask_bits(src3p), small_cpumask_bits);
646}
647
648/**
649 * cpumask_intersects - (*src1p & *src2p) != 0
650 * @src1p: the first input
651 * @src2p: the second input
652 *
653 * Return: true if first cpumask ANDed with second cpumask is non-empty,
654 *	   otherwise false
655 */
656static inline bool cpumask_intersects(const struct cpumask *src1p,
657				     const struct cpumask *src2p)
658{
659	return bitmap_intersects(cpumask_bits(src1p), cpumask_bits(src2p),
660						      small_cpumask_bits);
661}
662
663/**
664 * cpumask_subset - (*src1p & ~*src2p) == 0
665 * @src1p: the first input
666 * @src2p: the second input
667 *
668 * Return: true if *@src1p is a subset of *@src2p, else returns false
669 */
670static inline bool cpumask_subset(const struct cpumask *src1p,
671				 const struct cpumask *src2p)
672{
673	return bitmap_subset(cpumask_bits(src1p), cpumask_bits(src2p),
674						  small_cpumask_bits);
675}
676
677/**
678 * cpumask_empty - *srcp == 0
679 * @srcp: the cpumask to that all cpus < nr_cpu_ids are clear.
680 *
681 * Return: true if srcp is empty (has no bits set), else false
682 */
683static inline bool cpumask_empty(const struct cpumask *srcp)
684{
685	return bitmap_empty(cpumask_bits(srcp), small_cpumask_bits);
686}
687
688/**
689 * cpumask_full - *srcp == 0xFFFFFFFF...
690 * @srcp: the cpumask to that all cpus < nr_cpu_ids are set.
691 *
692 * Return: true if srcp is full (has all bits set), else false
693 */
694static inline bool cpumask_full(const struct cpumask *srcp)
695{
696	return bitmap_full(cpumask_bits(srcp), nr_cpumask_bits);
697}
698
699/**
700 * cpumask_weight - Count of bits in *srcp
701 * @srcp: the cpumask to count bits (< nr_cpu_ids) in.
702 *
703 * Return: count of bits set in *srcp
704 */
705static inline unsigned int cpumask_weight(const struct cpumask *srcp)
706{
707	return bitmap_weight(cpumask_bits(srcp), small_cpumask_bits);
708}
709
710/**
711 * cpumask_weight_and - Count of bits in (*srcp1 & *srcp2)
712 * @srcp1: the cpumask to count bits (< nr_cpu_ids) in.
713 * @srcp2: the cpumask to count bits (< nr_cpu_ids) in.
714 *
715 * Return: count of bits set in both *srcp1 and *srcp2
716 */
717static inline unsigned int cpumask_weight_and(const struct cpumask *srcp1,
718						const struct cpumask *srcp2)
719{
720	return bitmap_weight_and(cpumask_bits(srcp1), cpumask_bits(srcp2), small_cpumask_bits);
721}
722
723/**
724 * cpumask_weight_andnot - Count of bits in (*srcp1 & ~*srcp2)
725 * @srcp1: the cpumask to count bits (< nr_cpu_ids) in.
726 * @srcp2: the cpumask to count bits (< nr_cpu_ids) in.
727 *
728 * Return: count of bits set in both *srcp1 and *srcp2
729 */
730static inline unsigned int cpumask_weight_andnot(const struct cpumask *srcp1,
731						const struct cpumask *srcp2)
732{
733	return bitmap_weight_andnot(cpumask_bits(srcp1), cpumask_bits(srcp2), small_cpumask_bits);
734}
735
736/**
737 * cpumask_shift_right - *dstp = *srcp >> n
738 * @dstp: the cpumask result
739 * @srcp: the input to shift
740 * @n: the number of bits to shift by
741 */
742static inline void cpumask_shift_right(struct cpumask *dstp,
743				       const struct cpumask *srcp, int n)
744{
745	bitmap_shift_right(cpumask_bits(dstp), cpumask_bits(srcp), n,
746					       small_cpumask_bits);
747}
748
749/**
750 * cpumask_shift_left - *dstp = *srcp << n
751 * @dstp: the cpumask result
752 * @srcp: the input to shift
753 * @n: the number of bits to shift by
754 */
755static inline void cpumask_shift_left(struct cpumask *dstp,
756				      const struct cpumask *srcp, int n)
757{
758	bitmap_shift_left(cpumask_bits(dstp), cpumask_bits(srcp), n,
759					      nr_cpumask_bits);
760}
761
762/**
763 * cpumask_copy - *dstp = *srcp
764 * @dstp: the result
765 * @srcp: the input cpumask
766 */
767static inline void cpumask_copy(struct cpumask *dstp,
768				const struct cpumask *srcp)
769{
770	bitmap_copy(cpumask_bits(dstp), cpumask_bits(srcp), large_cpumask_bits);
771}
772
773/**
774 * cpumask_any - pick a "random" cpu from *srcp
775 * @srcp: the input cpumask
776 *
777 * Return: >= nr_cpu_ids if no cpus set.
778 */
779#define cpumask_any(srcp) cpumask_first(srcp)
780
781/**
782 * cpumask_any_and - pick a "random" cpu from *mask1 & *mask2
783 * @mask1: the first input cpumask
784 * @mask2: the second input cpumask
785 *
786 * Return: >= nr_cpu_ids if no cpus set.
787 */
788#define cpumask_any_and(mask1, mask2) cpumask_first_and((mask1), (mask2))
789
790/**
791 * cpumask_of - the cpumask containing just a given cpu
792 * @cpu: the cpu (<= nr_cpu_ids)
793 */
794#define cpumask_of(cpu) (get_cpu_mask(cpu))
795
796/**
797 * cpumask_parse_user - extract a cpumask from a user string
798 * @buf: the buffer to extract from
799 * @len: the length of the buffer
800 * @dstp: the cpumask to set.
801 *
802 * Return: -errno, or 0 for success.
803 */
804static inline int cpumask_parse_user(const char __user *buf, int len,
805				     struct cpumask *dstp)
806{
807	return bitmap_parse_user(buf, len, cpumask_bits(dstp), nr_cpumask_bits);
808}
809
810/**
811 * cpumask_parselist_user - extract a cpumask from a user string
812 * @buf: the buffer to extract from
813 * @len: the length of the buffer
814 * @dstp: the cpumask to set.
815 *
816 * Return: -errno, or 0 for success.
817 */
818static inline int cpumask_parselist_user(const char __user *buf, int len,
819				     struct cpumask *dstp)
820{
821	return bitmap_parselist_user(buf, len, cpumask_bits(dstp),
822				     nr_cpumask_bits);
823}
824
825/**
826 * cpumask_parse - extract a cpumask from a string
827 * @buf: the buffer to extract from
828 * @dstp: the cpumask to set.
829 *
830 * Return: -errno, or 0 for success.
831 */
832static inline int cpumask_parse(const char *buf, struct cpumask *dstp)
833{
834	return bitmap_parse(buf, UINT_MAX, cpumask_bits(dstp), nr_cpumask_bits);
835}
836
837/**
838 * cpulist_parse - extract a cpumask from a user string of ranges
839 * @buf: the buffer to extract from
840 * @dstp: the cpumask to set.
841 *
842 * Return: -errno, or 0 for success.
843 */
844static inline int cpulist_parse(const char *buf, struct cpumask *dstp)
845{
846	return bitmap_parselist(buf, cpumask_bits(dstp), nr_cpumask_bits);
847}
848
849/**
850 * cpumask_size - calculate size to allocate for a 'struct cpumask' in bytes
851 *
852 * Return: size to allocate for a &struct cpumask in bytes
853 */
854static inline unsigned int cpumask_size(void)
855{
856	return BITS_TO_LONGS(large_cpumask_bits) * sizeof(long);
857}
858
859/*
860 * cpumask_var_t: struct cpumask for stack usage.
861 *
862 * Oh, the wicked games we play!  In order to make kernel coding a
863 * little more difficult, we typedef cpumask_var_t to an array or a
864 * pointer: doing &mask on an array is a noop, so it still works.
865 *
866 * i.e.
867 *	cpumask_var_t tmpmask;
868 *	if (!alloc_cpumask_var(&tmpmask, GFP_KERNEL))
869 *		return -ENOMEM;
870 *
871 *	  ... use 'tmpmask' like a normal struct cpumask * ...
872 *
873 *	free_cpumask_var(tmpmask);
874 *
875 *
876 * However, one notable exception is there. alloc_cpumask_var() allocates
877 * only nr_cpumask_bits bits (in the other hand, real cpumask_t always has
878 * NR_CPUS bits). Therefore you don't have to dereference cpumask_var_t.
879 *
880 *	cpumask_var_t tmpmask;
881 *	if (!alloc_cpumask_var(&tmpmask, GFP_KERNEL))
882 *		return -ENOMEM;
883 *
884 *	var = *tmpmask;
885 *
886 * This code makes NR_CPUS length memcopy and brings to a memory corruption.
887 * cpumask_copy() provide safe copy functionality.
888 *
889 * Note that there is another evil here: If you define a cpumask_var_t
890 * as a percpu variable then the way to obtain the address of the cpumask
891 * structure differently influences what this_cpu_* operation needs to be
892 * used. Please use this_cpu_cpumask_var_t in those cases. The direct use
893 * of this_cpu_ptr() or this_cpu_read() will lead to failures when the
894 * other type of cpumask_var_t implementation is configured.
895 *
896 * Please also note that __cpumask_var_read_mostly can be used to declare
897 * a cpumask_var_t variable itself (not its content) as read mostly.
898 */
899#ifdef CONFIG_CPUMASK_OFFSTACK
900typedef struct cpumask *cpumask_var_t;
901
902#define this_cpu_cpumask_var_ptr(x)	this_cpu_read(x)
903#define __cpumask_var_read_mostly	__read_mostly
904
905bool alloc_cpumask_var_node(cpumask_var_t *mask, gfp_t flags, int node);
906
907static inline
908bool zalloc_cpumask_var_node(cpumask_var_t *mask, gfp_t flags, int node)
909{
910	return alloc_cpumask_var_node(mask, flags | __GFP_ZERO, node);
911}
912
913/**
914 * alloc_cpumask_var - allocate a struct cpumask
915 * @mask: pointer to cpumask_var_t where the cpumask is returned
916 * @flags: GFP_ flags
917 *
918 * Only defined when CONFIG_CPUMASK_OFFSTACK=y, otherwise is
919 * a nop returning a constant 1 (in <linux/cpumask.h>).
920 *
921 * See alloc_cpumask_var_node.
922 *
923 * Return: %true if allocation succeeded, %false if not
924 */
925static inline
926bool alloc_cpumask_var(cpumask_var_t *mask, gfp_t flags)
927{
928	return alloc_cpumask_var_node(mask, flags, NUMA_NO_NODE);
929}
930
931static inline
932bool zalloc_cpumask_var(cpumask_var_t *mask, gfp_t flags)
933{
934	return alloc_cpumask_var(mask, flags | __GFP_ZERO);
935}
936
937void alloc_bootmem_cpumask_var(cpumask_var_t *mask);
938void free_cpumask_var(cpumask_var_t mask);
939void free_bootmem_cpumask_var(cpumask_var_t mask);
940
941static inline bool cpumask_available(cpumask_var_t mask)
942{
943	return mask != NULL;
944}
945
946#else
947typedef struct cpumask cpumask_var_t[1];
948
949#define this_cpu_cpumask_var_ptr(x) this_cpu_ptr(x)
950#define __cpumask_var_read_mostly
951
952static inline bool alloc_cpumask_var(cpumask_var_t *mask, gfp_t flags)
953{
954	return true;
955}
956
957static inline bool alloc_cpumask_var_node(cpumask_var_t *mask, gfp_t flags,
958					  int node)
959{
960	return true;
961}
962
963static inline bool zalloc_cpumask_var(cpumask_var_t *mask, gfp_t flags)
964{
965	cpumask_clear(*mask);
966	return true;
967}
968
969static inline bool zalloc_cpumask_var_node(cpumask_var_t *mask, gfp_t flags,
970					  int node)
971{
972	cpumask_clear(*mask);
973	return true;
974}
975
976static inline void alloc_bootmem_cpumask_var(cpumask_var_t *mask)
977{
978}
979
980static inline void free_cpumask_var(cpumask_var_t mask)
981{
982}
983
984static inline void free_bootmem_cpumask_var(cpumask_var_t mask)
985{
986}
987
988static inline bool cpumask_available(cpumask_var_t mask)
989{
990	return true;
991}
992#endif /* CONFIG_CPUMASK_OFFSTACK */
993
994DEFINE_FREE(free_cpumask_var, struct cpumask *, if (_T) free_cpumask_var(_T));
995
996/* It's common to want to use cpu_all_mask in struct member initializers,
997 * so it has to refer to an address rather than a pointer. */
998extern const DECLARE_BITMAP(cpu_all_bits, NR_CPUS);
999#define cpu_all_mask to_cpumask(cpu_all_bits)
1000
1001/* First bits of cpu_bit_bitmap are in fact unset. */
1002#define cpu_none_mask to_cpumask(cpu_bit_bitmap[0])
1003
1004#if NR_CPUS == 1
1005/* Uniprocessor: the possible/online/present masks are always "1" */
1006#define for_each_possible_cpu(cpu)	for ((cpu) = 0; (cpu) < 1; (cpu)++)
1007#define for_each_online_cpu(cpu)	for ((cpu) = 0; (cpu) < 1; (cpu)++)
1008#define for_each_present_cpu(cpu)	for ((cpu) = 0; (cpu) < 1; (cpu)++)
1009#else
1010#define for_each_possible_cpu(cpu) for_each_cpu((cpu), cpu_possible_mask)
1011#define for_each_online_cpu(cpu)   for_each_cpu((cpu), cpu_online_mask)
1012#define for_each_present_cpu(cpu)  for_each_cpu((cpu), cpu_present_mask)
1013#endif
1014
1015/* Wrappers for arch boot code to manipulate normally-constant masks */
1016void init_cpu_present(const struct cpumask *src);
1017void init_cpu_possible(const struct cpumask *src);
1018void init_cpu_online(const struct cpumask *src);
1019
1020static inline void reset_cpu_possible_mask(void)
1021{
1022	bitmap_zero(cpumask_bits(&__cpu_possible_mask), NR_CPUS);
1023}
1024
1025static inline void
1026set_cpu_possible(unsigned int cpu, bool possible)
1027{
1028	if (possible)
1029		cpumask_set_cpu(cpu, &__cpu_possible_mask);
1030	else
1031		cpumask_clear_cpu(cpu, &__cpu_possible_mask);
1032}
1033
1034static inline void
1035set_cpu_present(unsigned int cpu, bool present)
1036{
1037	if (present)
1038		cpumask_set_cpu(cpu, &__cpu_present_mask);
1039	else
1040		cpumask_clear_cpu(cpu, &__cpu_present_mask);
1041}
1042
1043void set_cpu_online(unsigned int cpu, bool online);
1044
1045static inline void
1046set_cpu_active(unsigned int cpu, bool active)
1047{
1048	if (active)
1049		cpumask_set_cpu(cpu, &__cpu_active_mask);
1050	else
1051		cpumask_clear_cpu(cpu, &__cpu_active_mask);
1052}
1053
1054static inline void
1055set_cpu_dying(unsigned int cpu, bool dying)
1056{
1057	if (dying)
1058		cpumask_set_cpu(cpu, &__cpu_dying_mask);
1059	else
1060		cpumask_clear_cpu(cpu, &__cpu_dying_mask);
1061}
1062
1063/**
1064 * to_cpumask - convert a NR_CPUS bitmap to a struct cpumask *
1065 * @bitmap: the bitmap
1066 *
1067 * There are a few places where cpumask_var_t isn't appropriate and
1068 * static cpumasks must be used (eg. very early boot), yet we don't
1069 * expose the definition of 'struct cpumask'.
1070 *
1071 * This does the conversion, and can be used as a constant initializer.
1072 */
1073#define to_cpumask(bitmap)						\
1074	((struct cpumask *)(1 ? (bitmap)				\
1075			    : (void *)sizeof(__check_is_bitmap(bitmap))))
1076
1077static inline int __check_is_bitmap(const unsigned long *bitmap)
1078{
1079	return 1;
1080}
1081
1082/*
1083 * Special-case data structure for "single bit set only" constant CPU masks.
1084 *
1085 * We pre-generate all the 64 (or 32) possible bit positions, with enough
1086 * padding to the left and the right, and return the constant pointer
1087 * appropriately offset.
1088 */
1089extern const unsigned long
1090	cpu_bit_bitmap[BITS_PER_LONG+1][BITS_TO_LONGS(NR_CPUS)];
1091
1092static inline const struct cpumask *get_cpu_mask(unsigned int cpu)
1093{
1094	const unsigned long *p = cpu_bit_bitmap[1 + cpu % BITS_PER_LONG];
1095	p -= cpu / BITS_PER_LONG;
1096	return to_cpumask(p);
1097}
1098
1099#if NR_CPUS > 1
1100/**
1101 * num_online_cpus() - Read the number of online CPUs
1102 *
1103 * Despite the fact that __num_online_cpus is of type atomic_t, this
1104 * interface gives only a momentary snapshot and is not protected against
1105 * concurrent CPU hotplug operations unless invoked from a cpuhp_lock held
1106 * region.
1107 *
1108 * Return: momentary snapshot of the number of online CPUs
1109 */
1110static __always_inline unsigned int num_online_cpus(void)
1111{
1112	return raw_atomic_read(&__num_online_cpus);
1113}
1114#define num_possible_cpus()	cpumask_weight(cpu_possible_mask)
1115#define num_present_cpus()	cpumask_weight(cpu_present_mask)
1116#define num_active_cpus()	cpumask_weight(cpu_active_mask)
1117
1118static inline bool cpu_online(unsigned int cpu)
1119{
1120	return cpumask_test_cpu(cpu, cpu_online_mask);
1121}
1122
1123static inline bool cpu_possible(unsigned int cpu)
1124{
1125	return cpumask_test_cpu(cpu, cpu_possible_mask);
1126}
1127
1128static inline bool cpu_present(unsigned int cpu)
1129{
1130	return cpumask_test_cpu(cpu, cpu_present_mask);
1131}
1132
1133static inline bool cpu_active(unsigned int cpu)
1134{
1135	return cpumask_test_cpu(cpu, cpu_active_mask);
1136}
1137
1138static inline bool cpu_dying(unsigned int cpu)
1139{
1140	return cpumask_test_cpu(cpu, cpu_dying_mask);
1141}
1142
1143#else
1144
1145#define num_online_cpus()	1U
1146#define num_possible_cpus()	1U
1147#define num_present_cpus()	1U
1148#define num_active_cpus()	1U
1149
1150static inline bool cpu_online(unsigned int cpu)
1151{
1152	return cpu == 0;
1153}
1154
1155static inline bool cpu_possible(unsigned int cpu)
1156{
1157	return cpu == 0;
1158}
1159
1160static inline bool cpu_present(unsigned int cpu)
1161{
1162	return cpu == 0;
1163}
1164
1165static inline bool cpu_active(unsigned int cpu)
1166{
1167	return cpu == 0;
1168}
1169
1170static inline bool cpu_dying(unsigned int cpu)
1171{
1172	return false;
1173}
1174
1175#endif /* NR_CPUS > 1 */
1176
1177#define cpu_is_offline(cpu)	unlikely(!cpu_online(cpu))
1178
1179#if NR_CPUS <= BITS_PER_LONG
1180#define CPU_BITS_ALL						\
1181{								\
1182	[BITS_TO_LONGS(NR_CPUS)-1] = BITMAP_LAST_WORD_MASK(NR_CPUS)	\
1183}
1184
1185#else /* NR_CPUS > BITS_PER_LONG */
1186
1187#define CPU_BITS_ALL						\
1188{								\
1189	[0 ... BITS_TO_LONGS(NR_CPUS)-2] = ~0UL,		\
1190	[BITS_TO_LONGS(NR_CPUS)-1] = BITMAP_LAST_WORD_MASK(NR_CPUS)	\
1191}
1192#endif /* NR_CPUS > BITS_PER_LONG */
1193
1194/**
1195 * cpumap_print_to_pagebuf  - copies the cpumask into the buffer either
1196 *	as comma-separated list of cpus or hex values of cpumask
1197 * @list: indicates whether the cpumap must be list
1198 * @mask: the cpumask to copy
1199 * @buf: the buffer to copy into
1200 *
1201 * Return: the length of the (null-terminated) @buf string, zero if
1202 * nothing is copied.
1203 */
1204static inline ssize_t
1205cpumap_print_to_pagebuf(bool list, char *buf, const struct cpumask *mask)
1206{
1207	return bitmap_print_to_pagebuf(list, buf, cpumask_bits(mask),
1208				      nr_cpu_ids);
1209}
1210
1211/**
1212 * cpumap_print_bitmask_to_buf  - copies the cpumask into the buffer as
1213 *	hex values of cpumask
1214 *
1215 * @buf: the buffer to copy into
1216 * @mask: the cpumask to copy
1217 * @off: in the string from which we are copying, we copy to @buf
1218 * @count: the maximum number of bytes to print
1219 *
1220 * The function prints the cpumask into the buffer as hex values of
1221 * cpumask; Typically used by bin_attribute to export cpumask bitmask
1222 * ABI.
1223 *
1224 * Return: the length of how many bytes have been copied, excluding
1225 * terminating '\0'.
1226 */
1227static inline ssize_t
1228cpumap_print_bitmask_to_buf(char *buf, const struct cpumask *mask,
1229		loff_t off, size_t count)
1230{
1231	return bitmap_print_bitmask_to_buf(buf, cpumask_bits(mask),
1232				   nr_cpu_ids, off, count) - 1;
1233}
1234
1235/**
1236 * cpumap_print_list_to_buf  - copies the cpumask into the buffer as
1237 *	comma-separated list of cpus
1238 * @buf: the buffer to copy into
1239 * @mask: the cpumask to copy
1240 * @off: in the string from which we are copying, we copy to @buf
1241 * @count: the maximum number of bytes to print
1242 *
1243 * Everything is same with the above cpumap_print_bitmask_to_buf()
1244 * except the print format.
1245 *
1246 * Return: the length of how many bytes have been copied, excluding
1247 * terminating '\0'.
1248 */
1249static inline ssize_t
1250cpumap_print_list_to_buf(char *buf, const struct cpumask *mask,
1251		loff_t off, size_t count)
1252{
1253	return bitmap_print_list_to_buf(buf, cpumask_bits(mask),
1254				   nr_cpu_ids, off, count) - 1;
1255}
1256
1257#if NR_CPUS <= BITS_PER_LONG
1258#define CPU_MASK_ALL							\
1259(cpumask_t) { {								\
1260	[BITS_TO_LONGS(NR_CPUS)-1] = BITMAP_LAST_WORD_MASK(NR_CPUS)	\
1261} }
1262#else
1263#define CPU_MASK_ALL							\
1264(cpumask_t) { {								\
1265	[0 ... BITS_TO_LONGS(NR_CPUS)-2] = ~0UL,			\
1266	[BITS_TO_LONGS(NR_CPUS)-1] = BITMAP_LAST_WORD_MASK(NR_CPUS)	\
1267} }
1268#endif /* NR_CPUS > BITS_PER_LONG */
1269
1270#define CPU_MASK_NONE							\
1271(cpumask_t) { {								\
1272	[0 ... BITS_TO_LONGS(NR_CPUS)-1] =  0UL				\
1273} }
1274
1275#define CPU_MASK_CPU0							\
1276(cpumask_t) { {								\
1277	[0] =  1UL							\
1278} }
1279
1280/*
1281 * Provide a valid theoretical max size for cpumap and cpulist sysfs files
1282 * to avoid breaking userspace which may allocate a buffer based on the size
1283 * reported by e.g. fstat.
1284 *
1285 * for cpumap NR_CPUS * 9/32 - 1 should be an exact length.
1286 *
1287 * For cpulist 7 is (ceil(log10(NR_CPUS)) + 1) allowing for NR_CPUS to be up
1288 * to 2 orders of magnitude larger than 8192. And then we divide by 2 to
1289 * cover a worst-case of every other cpu being on one of two nodes for a
1290 * very large NR_CPUS.
1291 *
1292 *  Use PAGE_SIZE as a minimum for smaller configurations while avoiding
1293 *  unsigned comparison to -1.
1294 */
1295#define CPUMAP_FILE_MAX_BYTES  (((NR_CPUS * 9)/32 > PAGE_SIZE) \
1296					? (NR_CPUS * 9)/32 - 1 : PAGE_SIZE)
1297#define CPULIST_FILE_MAX_BYTES  (((NR_CPUS * 7)/2 > PAGE_SIZE) ? (NR_CPUS * 7)/2 : PAGE_SIZE)
1298
1299#endif /* __LINUX_CPUMASK_H */
1300