History

Merge tag 'bitmap-for-6.12' of https://github.com/norov/linux

Pull bitmap updates from Yury Norov: - switch all bitmamp APIs from inline to __always_inline (Brian Norris) The __always_inline series improves on code generation, and now with the latest compiler versions is required to avoid compilation warnings. It spent enough in my backlog, and I'm thankful to Brian Norris for taking over and moving it forward. - introduce GENMASK_U128() macro (Anshuman Khandual) GENMASK_U128() is a prerequisite needed for arm64 development * tag 'bitmap-for-6.12' of https://github.com/norov/linux: lib/test_bits.c: Add tests for GENMASK_U128() uapi: Define GENMASK_U128 nodemask: Switch from inline to __always_inline cpumask: Switch from inline to __always_inline bitmap: Switch from inline to __always_inline find: Switch from inline to __always_inline

Linus Torvalds committed 2 years ago

Commit 9c445752 parents ba33a49 d7bcc378 files · +325 −232Browse files

Unified · Split

8 files
  1. include/linux/bitmap.h +76 −64
  2. include/linux/bits.h +15 −0
  3. include/linux/cpumask.h +112 −100
  4. include/linux/find.h +25 −25
  5. include/linux/nodemask.h +43 −43
  6. include/uapi/linux/bits.h +3 −0
  7. include/uapi/linux/const.h +17 −0
  8. lib/test_bits.c +34 −0
include/linux/bitmap.h+76−64
@@ -203,12 +203,12 @@ unsigned long bitmap_find_next_zero_area_off(unsigned long *map, · 202 unmodified lines
203203 * the bit offset of all zero areas this function finds is multiples of that
204204 * power of 2. A @align_mask of 0 means no alignment is required.
205205 */
206−static inline unsigned long
207−bitmap_find_next_zero_area(unsigned long *map,
208− unsigned long size,
209− unsigned long start,
210− unsigned int nr,
211− unsigned long align_mask)
206+static __always_inline
207+unsigned long bitmap_find_next_zero_area(unsigned long *map,
208+ unsigned long size,
209+ unsigned long start,
210+ unsigned int nr,
211+ unsigned long align_mask)
212212 {
213213 return bitmap_find_next_zero_area_off(map, size, start, nr,
214214 align_mask, 0);
@@ -228,7 +228,7 @@ void bitmap_fold(unsigned long *dst, const unsigned long *orig, · 13 unmodified lines
228228
229229 #define bitmap_size(nbits) (ALIGN(nbits, BITS_PER_LONG) / BITS_PER_BYTE)
230230
231−static inline void bitmap_zero(unsigned long *dst, unsigned int nbits)
231+static __always_inline void bitmap_zero(unsigned long *dst, unsigned int nbits)
232232 {
233233 unsigned int len = bitmap_size(nbits);
234234
@@ -238,7 +238,7 @@ static inline void bitmap_zero(unsigned long *dst, unsigned int nbits) · 3 unmodified lines
238238 memset(dst, 0, len);
239239 }
240240
241−static inline void bitmap_fill(unsigned long *dst, unsigned int nbits)
241+static __always_inline void bitmap_fill(unsigned long *dst, unsigned int nbits)
242242 {
243243 unsigned int len = bitmap_size(nbits);
244244
@@ -248,8 +248,8 @@ static inline void bitmap_fill(unsigned long *dst, unsigned int nbits) · 3 unmodified lines
248248 memset(dst, 0xff, len);
249249 }
250250
251−static inline void bitmap_copy(unsigned long *dst, const unsigned long *src,
252− unsigned int nbits)
251+static __always_inline
252+void bitmap_copy(unsigned long *dst, const unsigned long *src, unsigned int nbits)
253253 {
254254 unsigned int len = bitmap_size(nbits);
255255
@@ -262,8 +262,8 @@ static inline void bitmap_copy(unsigned long *dst, const unsigned long *src, · 6 unmodified lines
262262 /*
263263 * Copy bitmap and clear tail bits in last word.
264264 */
265−static inline void bitmap_copy_clear_tail(unsigned long *dst,
266− const unsigned long *src, unsigned int nbits)
265+static __always_inline
266+void bitmap_copy_clear_tail(unsigned long *dst, const unsigned long *src, unsigned int nbits)
267267 {
268268 bitmap_copy(dst, src, nbits);
269269 if (nbits % BITS_PER_LONG)
@@ -318,16 +318,18 @@ void bitmap_to_arr64(u64 *buf, const unsigned long *bitmap, unsigned int nbits); · 48 unmodified lines
318318 bitmap_copy_clear_tail((unsigned long *)(buf), (const unsigned long *)(bitmap), (nbits))
319319 #endif
320320
321−static inline bool bitmap_and(unsigned long *dst, const unsigned long *src1,
322− const unsigned long *src2, unsigned int nbits)
321+static __always_inline
322+bool bitmap_and(unsigned long *dst, const unsigned long *src1,
323+ const unsigned long *src2, unsigned int nbits)
323324 {
324325 if (small_const_nbits(nbits))
325326 return (*dst = *src1 & *src2 & BITMAP_LAST_WORD_MASK(nbits)) != 0;
326327 return __bitmap_and(dst, src1, src2, nbits);
327328 }
328329
329−static inline void bitmap_or(unsigned long *dst, const unsigned long *src1,
330− const unsigned long *src2, unsigned int nbits)
330+static __always_inline
331+void bitmap_or(unsigned long *dst, const unsigned long *src1,
332+ const unsigned long *src2, unsigned int nbits)
331333 {
332334 if (small_const_nbits(nbits))
333335 *dst = *src1 | *src2;
@@ -335,8 +337,9 @@ static inline void bitmap_or(unsigned long *dst, const unsigned long *src1, · 1 unmodified line
335337 __bitmap_or(dst, src1, src2, nbits);
336338 }
337339
338−static inline void bitmap_xor(unsigned long *dst, const unsigned long *src1,
339− const unsigned long *src2, unsigned int nbits)
340+static __always_inline
341+void bitmap_xor(unsigned long *dst, const unsigned long *src1,
342+ const unsigned long *src2, unsigned int nbits)
340343 {
341344 if (small_const_nbits(nbits))
342345 *dst = *src1 ^ *src2;
@@ -344,16 +347,17 @@ static inline void bitmap_xor(unsigned long *dst, const unsigned long *src1, · 1 unmodified line
344347 __bitmap_xor(dst, src1, src2, nbits);
345348 }
346349
347−static inline bool bitmap_andnot(unsigned long *dst, const unsigned long *src1,
348− const unsigned long *src2, unsigned int nbits)
350+static __always_inline
351+bool bitmap_andnot(unsigned long *dst, const unsigned long *src1,
352+ const unsigned long *src2, unsigned int nbits)
349353 {
350354 if (small_const_nbits(nbits))
351355 return (*dst = *src1 & ~(*src2) & BITMAP_LAST_WORD_MASK(nbits)) != 0;
352356 return __bitmap_andnot(dst, src1, src2, nbits);
353357 }
354358
355−static inline void bitmap_complement(unsigned long *dst, const unsigned long *src,
356− unsigned int nbits)
359+static __always_inline
360+void bitmap_complement(unsigned long *dst, const unsigned long *src, unsigned int nbits)
357361 {
358362 if (small_const_nbits(nbits))
359363 *dst = ~(*src);
@@ -368,8 +372,8 @@ static inline void bitmap_complement(unsigned long *dst, const unsigned long *sr · 8 unmodified lines
368372 #endif
369373 #define BITMAP_MEM_MASK (BITMAP_MEM_ALIGNMENT - 1)
370374
371−static inline bool bitmap_equal(const unsigned long *src1,
372− const unsigned long *src2, unsigned int nbits)
375+static __always_inline
376+bool bitmap_equal(const unsigned long *src1, const unsigned long *src2, unsigned int nbits)
373377 {
374378 if (small_const_nbits(nbits))
375379 return !((*src1 ^ *src2) & BITMAP_LAST_WORD_MASK(nbits));
@@ -388,10 +392,9 @@ static inline bool bitmap_equal(const unsigned long *src1, · 12 unmodified lines
388392 *
389393 * Returns: True if (*@src1 | *@src2) == *@src3, false otherwise
390394 */
391−static inline bool bitmap_or_equal(const unsigned long *src1,
392− const unsigned long *src2,
393− const unsigned long *src3,
394− unsigned int nbits)
395+static __always_inline
396+bool bitmap_or_equal(const unsigned long *src1, const unsigned long *src2,
397+ const unsigned long *src3, unsigned int nbits)
395398 {
396399 if (!small_const_nbits(nbits))
397400 return __bitmap_or_equal(src1, src2, src3, nbits);
@@ -399,9 +402,8 @@ static inline bool bitmap_or_equal(const unsigned long *src1, · 1 unmodified line
399402 return !(((*src1 | *src2) ^ *src3) & BITMAP_LAST_WORD_MASK(nbits));
400403 }
401404
402−static inline bool bitmap_intersects(const unsigned long *src1,
403− const unsigned long *src2,
404− unsigned int nbits)
405+static __always_inline
406+bool bitmap_intersects(const unsigned long *src1, const unsigned long *src2, unsigned int nbits)
405407 {
406408 if (small_const_nbits(nbits))
407409 return ((*src1 & *src2) & BITMAP_LAST_WORD_MASK(nbits)) != 0;
@@ -409,8 +411,8 @@ static inline bool bitmap_intersects(const unsigned long *src1, · 1 unmodified line
409411 return __bitmap_intersects(src1, src2, nbits);
410412 }
411413
412−static inline bool bitmap_subset(const unsigned long *src1,
413− const unsigned long *src2, unsigned int nbits)
414+static __always_inline
415+bool bitmap_subset(const unsigned long *src1, const unsigned long *src2, unsigned int nbits)
414416 {
415417 if (small_const_nbits(nbits))
416418 return ! ((*src1 & ~(*src2)) & BITMAP_LAST_WORD_MASK(nbits));
@@ -418,7 +420,8 @@ static inline bool bitmap_subset(const unsigned long *src1, · 1 unmodified line
418420 return __bitmap_subset(src1, src2, nbits);
419421 }
420422
421−static inline bool bitmap_empty(const unsigned long *src, unsigned nbits)
423+static __always_inline
424+bool bitmap_empty(const unsigned long *src, unsigned nbits)
422425 {
423426 if (small_const_nbits(nbits))
424427 return ! (*src & BITMAP_LAST_WORD_MASK(nbits));
@@ -426,7 +429,8 @@ static inline bool bitmap_empty(const unsigned long *src, unsigned nbits) · 1 unmodified line
426429 return find_first_bit(src, nbits) == nbits;
427430 }
428431
429−static inline bool bitmap_full(const unsigned long *src, unsigned int nbits)
432+static __always_inline
433+bool bitmap_full(const unsigned long *src, unsigned int nbits)
430434 {
431435 if (small_const_nbits(nbits))
432436 return ! (~(*src) & BITMAP_LAST_WORD_MASK(nbits));
@@ -460,8 +464,8 @@ unsigned long bitmap_weight_andnot(const unsigned long *src1, · 27 unmodified lines
460464 return __bitmap_weight_andnot(src1, src2, nbits);
461465 }
462466
463−static __always_inline void bitmap_set(unsigned long *map, unsigned int start,
464− unsigned int nbits)
467+static __always_inline
468+void bitmap_set(unsigned long *map, unsigned int start, unsigned int nbits)
465469 {
466470 if (__builtin_constant_p(nbits) && nbits == 1)
467471 __set_bit(start, map);
@@ -476,8 +480,8 @@ static __always_inline void bitmap_set(unsigned long *map, unsigned int start, · 8 unmodified lines
476480 __bitmap_set(map, start, nbits);
477481 }
478482
479−static __always_inline void bitmap_clear(unsigned long *map, unsigned int start,
480− unsigned int nbits)
483+static __always_inline
484+void bitmap_clear(unsigned long *map, unsigned int start, unsigned int nbits)
481485 {
482486 if (__builtin_constant_p(nbits) && nbits == 1)
483487 __clear_bit(start, map);
@@ -492,8 +496,9 @@ static __always_inline void bitmap_clear(unsigned long *map, unsigned int start, · 8 unmodified lines
492496 __bitmap_clear(map, start, nbits);
493497 }
494498
495−static inline void bitmap_shift_right(unsigned long *dst, const unsigned long *src,
496− unsigned int shift, unsigned int nbits)
499+static __always_inline
500+void bitmap_shift_right(unsigned long *dst, const unsigned long *src,
501+ unsigned int shift, unsigned int nbits)
497502 {
498503 if (small_const_nbits(nbits))
499504 *dst = (*src & BITMAP_LAST_WORD_MASK(nbits)) >> shift;
@@ -501,8 +506,9 @@ static inline void bitmap_shift_right(unsigned long *dst, const unsigned long *s · 1 unmodified line
501506 __bitmap_shift_right(dst, src, shift, nbits);
502507 }
503508
504−static inline void bitmap_shift_left(unsigned long *dst, const unsigned long *src,
505− unsigned int shift, unsigned int nbits)
509+static __always_inline
510+void bitmap_shift_left(unsigned long *dst, const unsigned long *src,
511+ unsigned int shift, unsigned int nbits)
506512 {
507513 if (small_const_nbits(nbits))
508514 *dst = (*src << shift) & BITMAP_LAST_WORD_MASK(nbits);
@@ -510,11 +516,12 @@ static inline void bitmap_shift_left(unsigned long *dst, const unsigned long *sr · 1 unmodified line
510516 __bitmap_shift_left(dst, src, shift, nbits);
511517 }
512518
513−static inline void bitmap_replace(unsigned long *dst,
514− const unsigned long *old,
515− const unsigned long *new,
516− const unsigned long *mask,
517− unsigned int nbits)
519+static __always_inline
520+void bitmap_replace(unsigned long *dst,
521+ const unsigned long *old,
522+ const unsigned long *new,
523+ const unsigned long *mask,
524+ unsigned int nbits)
518525 {
519526 if (small_const_nbits(nbits))
520527 *dst = (*old & ~(*mask)) | (*new & *mask);
@@ -557,8 +564,9 @@ static inline void bitmap_replace(unsigned long *dst, · 36 unmodified lines
557564 * bitmap_gather() can be seen as the 'reverse' bitmap_scatter() operation.
558565 * See bitmap_scatter() for details related to this relationship.
559566 */
560−static inline void bitmap_scatter(unsigned long *dst, const unsigned long *src,
561− const unsigned long *mask, unsigned int nbits)
567+static __always_inline
568+void bitmap_scatter(unsigned long *dst, const unsigned long *src,
569+ const unsigned long *mask, unsigned int nbits)
562570 {
563571 unsigned int n = 0;
564572 unsigned int bit;
@@ -611,8 +619,9 @@ static inline void bitmap_scatter(unsigned long *dst, const unsigned long *src, · 46 unmodified lines
611619 * bitmap_scatter(res, src, mask, n) and a call to
612620 * bitmap_scatter(res, result, mask, n) will lead to the same res value.
613621 */
614−static inline void bitmap_gather(unsigned long *dst, const unsigned long *src,
615− const unsigned long *mask, unsigned int nbits)
622+static __always_inline
623+void bitmap_gather(unsigned long *dst, const unsigned long *src,
624+ const unsigned long *mask, unsigned int nbits)
616625 {
617626 unsigned int n = 0;
618627 unsigned int bit;
@@ -623,9 +632,9 @@ static inline void bitmap_gather(unsigned long *dst, const unsigned long *src, · 4 unmodified lines
623632 __assign_bit(n++, dst, test_bit(bit, src));
624633 }
625634
626−static inline void bitmap_next_set_region(unsigned long *bitmap,
627− unsigned int *rs, unsigned int *re,
628− unsigned int end)
635+static __always_inline
636+void bitmap_next_set_region(unsigned long *bitmap, unsigned int *rs,
637+ unsigned int *re, unsigned int end)
629638 {
630639 *rs = find_next_bit(bitmap, end, *rs);
631640 *re = find_next_zero_bit(bitmap, end, *rs + 1);
@@ -640,7 +649,8 @@ static inline void bitmap_next_set_region(unsigned long *bitmap, · 8 unmodified lines
640649 * This is the complement to __bitmap_find_free_region() and releases
641650 * the found region (by clearing it in the bitmap).
642651 */
643−static inline void bitmap_release_region(unsigned long *bitmap, unsigned int pos, int order)
652+static __always_inline
653+void bitmap_release_region(unsigned long *bitmap, unsigned int pos, int order)
644654 {
645655 bitmap_clear(bitmap, pos, BIT(order));
646656 }
@@ -656,7 +666,8 @@ static inline void bitmap_release_region(unsigned long *bitmap, unsigned int pos · 9 unmodified lines
656666 * Returns: 0 on success, or %-EBUSY if specified region wasn't
657667 * free (not all bits were zero).
658668 */
659−static inline int bitmap_allocate_region(unsigned long *bitmap, unsigned int pos, int order)
669+static __always_inline
670+int bitmap_allocate_region(unsigned long *bitmap, unsigned int pos, int order)
660671 {
661672 unsigned int len = BIT(order);
662673
@@ -680,7 +691,8 @@ static inline int bitmap_allocate_region(unsigned long *bitmap, unsigned int pos · 17 unmodified lines
680691 * Returns: the bit offset in bitmap of the allocated region,
681692 * or -errno on failure.
682693 */
683−static inline int bitmap_find_free_region(unsigned long *bitmap, unsigned int bits, int order)
694+static __always_inline
695+int bitmap_find_free_region(unsigned long *bitmap, unsigned int bits, int order)
684696 {
685697 unsigned int pos, end; /* scans bitmap by regions of size order */
686698
@@ -734,7 +746,7 @@ static inline int bitmap_find_free_region(unsigned long *bitmap, unsigned int bi · 47 unmodified lines
734746 * That is ``(u32 *)(&val)[0]`` gets the upper 32 bits,
735747 * but we expect the lower 32-bits of u64.
736748 */
737−static inline void bitmap_from_u64(unsigned long *dst, u64 mask)
749+static __always_inline void bitmap_from_u64(unsigned long *dst, u64 mask)
738750 {
739751 bitmap_from_arr64(dst, &mask, 64);
740752 }
@@ -749,9 +761,8 @@ static inline void bitmap_from_u64(unsigned long *dst, u64 mask) · 8 unmodified lines
749761 * @map memory region. For @nbits = 0 and @nbits > BITS_PER_LONG the return
750762 * value is undefined.
751763 */
752−static inline unsigned long bitmap_read(const unsigned long *map,
753− unsigned long start,
754− unsigned long nbits)
764+static __always_inline
765+unsigned long bitmap_read(const unsigned long *map, unsigned long start, unsigned long nbits)
755766 {
756767 size_t index = BIT_WORD(start);
757768 unsigned long offset = start % BITS_PER_LONG;
@@ -784,8 +795,9 @@ static inline unsigned long bitmap_read(const unsigned long *map, · 26 unmodified lines
784795 *
785796 * For @nbits == 0 and @nbits > BITS_PER_LONG no writes are performed.
786797 */
787−static inline void bitmap_write(unsigned long *map, unsigned long value,
788− unsigned long start, unsigned long nbits)
798+static __always_inline
799+void bitmap_write(unsigned long *map, unsigned long value,
800+ unsigned long start, unsigned long nbits)
789801 {
790802 size_t index;
791803 unsigned long offset;
include/linux/bits.h+15−0
@@ -36,4 +36,19 @@ · 35 unmodified lines
3636 #define GENMASK_ULL(h, l) \
3737 (GENMASK_INPUT_CHECK(h, l) + __GENMASK_ULL(h, l))
3838
39+#if !defined(__ASSEMBLY__)
40+/*
41+ * Missing asm support
42+ *
43+ * __GENMASK_U128() depends on _BIT128() which would not work
44+ * in the asm code, as it shifts an 'unsigned __init128' data
45+ * type instead of direct representation of 128 bit constants
46+ * such as long and unsigned long. The fundamental problem is
47+ * that a 128 bit constant will get silently truncated by the
48+ * gcc compiler.
49+ */
50+#define GENMASK_U128(h, l) \
51+ (GENMASK_INPUT_CHECK(h, l) + __GENMASK_U128(h, l))
52+#endif
53+
3954 #endif /* __LINUX_BITS_H */
include/linux/cpumask.h+112−100
@@ -30,7 +30,7 @@ · 29 unmodified lines
3030 extern unsigned int nr_cpu_ids;
3131 #endif
3232
33−static inline void set_nr_cpu_ids(unsigned int nr)
33+static __always_inline void set_nr_cpu_ids(unsigned int nr)
3434 {
3535 #if (NR_CPUS == 1) || defined(CONFIG_FORCE_NR_CPUS)
3636 WARN_ON(nr != nr_cpu_ids);
@@ -149,7 +149,7 @@ static __always_inline unsigned int cpumask_check(unsigned int cpu) · 112 unmodified lines
149149 *
150150 * Return: >= nr_cpu_ids if no cpus set.
151151 */
152−static inline unsigned int cpumask_first(const struct cpumask *srcp)
152+static __always_inline unsigned int cpumask_first(const struct cpumask *srcp)
153153 {
154154 return find_first_bit(cpumask_bits(srcp), small_cpumask_bits);
155155 }
@@ -160,7 +160,7 @@ static inline unsigned int cpumask_first(const struct cpumask *srcp) · 4 unmodified lines
160160 *
161161 * Return: >= nr_cpu_ids if all cpus are set.
162162 */
163−static inline unsigned int cpumask_first_zero(const struct cpumask *srcp)
163+static __always_inline unsigned int cpumask_first_zero(const struct cpumask *srcp)
164164 {
165165 return find_first_zero_bit(cpumask_bits(srcp), small_cpumask_bits);
166166 }
@@ -172,7 +172,7 @@ static inline unsigned int cpumask_first_zero(const struct cpumask *srcp) · 5 unmodified lines
172172 *
173173 * Return: >= nr_cpu_ids if no cpus set in both. See also cpumask_next_and().
174174 */
175−static inline
175+static __always_inline
176176 unsigned int cpumask_first_and(const struct cpumask *srcp1, const struct cpumask *srcp2)
177177 {
178178 return find_first_and_bit(cpumask_bits(srcp1), cpumask_bits(srcp2), small_cpumask_bits);
@@ -186,7 +186,7 @@ unsigned int cpumask_first_and(const struct cpumask *srcp1, const struct cpumask · 7 unmodified lines
186186 *
187187 * Return: >= nr_cpu_ids if no cpus set in all.
188188 */
189−static inline
189+static __always_inline
190190 unsigned int cpumask_first_and_and(const struct cpumask *srcp1,
191191 const struct cpumask *srcp2,
192192 const struct cpumask *srcp3)
@@ -201,7 +201,7 @@ unsigned int cpumask_first_and_and(const struct cpumask *srcp1, · 8 unmodified lines
201201 *
202202 * Return: >= nr_cpumask_bits if no CPUs set.
203203 */
204−static inline unsigned int cpumask_last(const struct cpumask *srcp)
204+static __always_inline unsigned int cpumask_last(const struct cpumask *srcp)
205205 {
206206 return find_last_bit(cpumask_bits(srcp), small_cpumask_bits);
207207 }
@@ -213,7 +213,7 @@ static inline unsigned int cpumask_last(const struct cpumask *srcp) · 5 unmodified lines
213213 *
214214 * Return: >= nr_cpu_ids if no further cpus set.
215215 */
216−static inline
216+static __always_inline
217217 unsigned int cpumask_next(int n, const struct cpumask *srcp)
218218 {
219219 /* -1 is a legal arg here. */
@@ -229,7 +229,8 @@ unsigned int cpumask_next(int n, const struct cpumask *srcp) · 9 unmodified lines
229229 *
230230 * Return: >= nr_cpu_ids if no further cpus unset.
231231 */
232−static inline unsigned int cpumask_next_zero(int n, const struct cpumask *srcp)
232+static __always_inline
233+unsigned int cpumask_next_zero(int n, const struct cpumask *srcp)
233234 {
234235 /* -1 is a legal arg here. */
235236 if (n != -1)
@@ -239,18 +240,21 @@ static inline unsigned int cpumask_next_zero(int n, const struct cpumask *srcp) · 3 unmodified lines
239240
240241 #if NR_CPUS == 1
241242 /* Uniprocessor: there is only one valid CPU */
242−static inline unsigned int cpumask_local_spread(unsigned int i, int node)
243+static __always_inline
244+unsigned int cpumask_local_spread(unsigned int i, int node)
243245 {
244246 return 0;
245247 }
246248
247−static inline unsigned int cpumask_any_and_distribute(const struct cpumask *src1p,
248− const struct cpumask *src2p)
249+static __always_inline
250+unsigned int cpumask_any_and_distribute(const struct cpumask *src1p,
251+ const struct cpumask *src2p)
249252 {
250253 return cpumask_first_and(src1p, src2p);
251254 }
252255
253−static inline unsigned int cpumask_any_distribute(const struct cpumask *srcp)
256+static __always_inline
257+unsigned int cpumask_any_distribute(const struct cpumask *srcp)
254258 {
255259 return cpumask_first(srcp);
256260 }
@@ -269,9 +273,9 @@ unsigned int cpumask_any_distribute(const struct cpumask *srcp); · 12 unmodified lines
269273 *
270274 * Return: >= nr_cpu_ids if no further cpus set in both.
271275 */
272−static inline
276+static __always_inline
273277 unsigned int cpumask_next_and(int n, const struct cpumask *src1p,
274− const struct cpumask *src2p)
278+ const struct cpumask *src2p)
275279 {
276280 /* -1 is a legal arg here. */
277281 if (n != -1)
@@ -291,7 +295,7 @@ unsigned int cpumask_next_and(int n, const struct cpumask *src1p, · 13 unmodified lines
291295 for_each_set_bit(cpu, cpumask_bits(mask), small_cpumask_bits)
292296
293297 #if NR_CPUS == 1
294−static inline
298+static __always_inline
295299 unsigned int cpumask_next_wrap(int n, const struct cpumask *mask, int start, bool wrap)
296300 {
297301 cpumask_check(start);
@@ -394,7 +398,7 @@ unsigned int __pure cpumask_next_wrap(int n, const struct cpumask *mask, int sta · 96 unmodified lines
394398 * Often used to find any cpu but smp_processor_id() in a mask.
395399 * Return: >= nr_cpu_ids if no cpus set.
396400 */
397−static inline
401+static __always_inline
398402 unsigned int cpumask_any_but(const struct cpumask *mask, unsigned int cpu)
399403 {
400404 unsigned int i;
@@ -414,7 +418,7 @@ unsigned int cpumask_any_but(const struct cpumask *mask, unsigned int cpu) · 13 unmodified lines
414418 *
415419 * Returns >= nr_cpu_ids if no cpus set.
416420 */
417−static inline
421+static __always_inline
418422 unsigned int cpumask_any_and_but(const struct cpumask *mask1,
419423 const struct cpumask *mask2,
420424 unsigned int cpu)
@@ -436,7 +440,8 @@ unsigned int cpumask_any_and_but(const struct cpumask *mask1, · 15 unmodified lines
436440 *
437441 * Return: >= nr_cpu_ids if such cpu doesn't exist.
438442 */
439−static inline unsigned int cpumask_nth(unsigned int cpu, const struct cpumask *srcp)
443+static __always_inline
444+unsigned int cpumask_nth(unsigned int cpu, const struct cpumask *srcp)
440445 {
441446 return find_nth_bit(cpumask_bits(srcp), small_cpumask_bits, cpumask_check(cpu));
442447 }
@@ -449,7 +454,7 @@ static inline unsigned int cpumask_nth(unsigned int cpu, const struct cpumask *s · 6 unmodified lines
449454 *
450455 * Return: >= nr_cpu_ids if such cpu doesn't exist.
451456 */
452−static inline
457+static __always_inline
453458 unsigned int cpumask_nth_and(unsigned int cpu, const struct cpumask *srcp1,
454459 const struct cpumask *srcp2)
455460 {
@@ -465,7 +470,7 @@ unsigned int cpumask_nth_and(unsigned int cpu, const struct cpumask *srcp1, · 9 unmodified lines
465470 *
466471 * Return: >= nr_cpu_ids if such cpu doesn't exist.
467472 */
468−static inline
473+static __always_inline
469474 unsigned int cpumask_nth_andnot(unsigned int cpu, const struct cpumask *srcp1,
470475 const struct cpumask *srcp2)
471476 {
@@ -508,12 +513,14 @@ unsigned int cpumask_nth_and_andnot(unsigned int cpu, const struct cpumask *srcp · 36 unmodified lines
508513 * @cpu: cpu number (< nr_cpu_ids)
509514 * @dstp: the cpumask pointer
510515 */
511−static __always_inline void cpumask_set_cpu(unsigned int cpu, struct cpumask *dstp)
516+static __always_inline
517+void cpumask_set_cpu(unsigned int cpu, struct cpumask *dstp)
512518 {
513519 set_bit(cpumask_check(cpu), cpumask_bits(dstp));
514520 }
515521
516−static __always_inline void __cpumask_set_cpu(unsigned int cpu, struct cpumask *dstp)
522+static __always_inline
523+void __cpumask_set_cpu(unsigned int cpu, struct cpumask *dstp)
517524 {
518525 __set_bit(cpumask_check(cpu), cpumask_bits(dstp));
519526 }
@@ -557,7 +564,8 @@ static __always_inline void __cpumask_assign_cpu(int cpu, struct cpumask *dstp, · 37 unmodified lines
557564 *
558565 * Return: true if @cpu is set in @cpumask, else returns false
559566 */
560−static __always_inline bool cpumask_test_cpu(int cpu, const struct cpumask *cpumask)
567+static __always_inline
568+bool cpumask_test_cpu(int cpu, const struct cpumask *cpumask)
561569 {
562570 return test_bit(cpumask_check(cpu), cpumask_bits((cpumask)));
563571 }
@@ -571,7 +579,8 @@ static __always_inline bool cpumask_test_cpu(int cpu, const struct cpumask *cpum · 7 unmodified lines
571579 *
572580 * Return: true if @cpu is set in old bitmap of @cpumask, else returns false
573581 */
574−static __always_inline bool cpumask_test_and_set_cpu(int cpu, struct cpumask *cpumask)
582+static __always_inline
583+bool cpumask_test_and_set_cpu(int cpu, struct cpumask *cpumask)
575584 {
576585 return test_and_set_bit(cpumask_check(cpu), cpumask_bits(cpumask));
577586 }
@@ -585,7 +594,8 @@ static __always_inline bool cpumask_test_and_set_cpu(int cpu, struct cpumask *cp · 7 unmodified lines
585594 *
586595 * Return: true if @cpu is set in old bitmap of @cpumask, else returns false
587596 */
588−static __always_inline bool cpumask_test_and_clear_cpu(int cpu, struct cpumask *cpumask)
597+static __always_inline
598+bool cpumask_test_and_clear_cpu(int cpu, struct cpumask *cpumask)
589599 {
590600 return test_and_clear_bit(cpumask_check(cpu), cpumask_bits(cpumask));
591601 }
@@ -594,7 +604,7 @@ static __always_inline bool cpumask_test_and_clear_cpu(int cpu, struct cpumask * · 2 unmodified lines
594604 * cpumask_setall - set all cpus (< nr_cpu_ids) in a cpumask
595605 * @dstp: the cpumask pointer
596606 */
597−static inline void cpumask_setall(struct cpumask *dstp)
607+static __always_inline void cpumask_setall(struct cpumask *dstp)
598608 {
599609 if (small_const_nbits(small_cpumask_bits)) {
600610 cpumask_bits(dstp)[0] = BITMAP_LAST_WORD_MASK(nr_cpumask_bits);
@@ -607,7 +617,7 @@ static inline void cpumask_setall(struct cpumask *dstp) · 6 unmodified lines
607617 * cpumask_clear - clear all cpus (< nr_cpu_ids) in a cpumask
608618 * @dstp: the cpumask pointer
609619 */
610−static inline void cpumask_clear(struct cpumask *dstp)
620+static __always_inline void cpumask_clear(struct cpumask *dstp)
611621 {
612622 bitmap_zero(cpumask_bits(dstp), large_cpumask_bits);
613623 }
@@ -620,9 +630,9 @@ static inline void cpumask_clear(struct cpumask *dstp) · 6 unmodified lines
620630 *
621631 * Return: false if *@dstp is empty, else returns true
622632 */
623−static inline bool cpumask_and(struct cpumask *dstp,
624− const struct cpumask *src1p,
625− const struct cpumask *src2p)
633+static __always_inline
634+bool cpumask_and(struct cpumask *dstp, const struct cpumask *src1p,
635+ const struct cpumask *src2p)
626636 {
627637 return bitmap_and(cpumask_bits(dstp), cpumask_bits(src1p),
628638 cpumask_bits(src2p), small_cpumask_bits);
@@ -634,8 +644,9 @@ static inline bool cpumask_and(struct cpumask *dstp, · 5 unmodified lines
634644 * @src1p: the first input
635645 * @src2p: the second input
636646 */
637−static inline void cpumask_or(struct cpumask *dstp, const struct cpumask *src1p,
638− const struct cpumask *src2p)
647+static __always_inline
648+void cpumask_or(struct cpumask *dstp, const struct cpumask *src1p,
649+ const struct cpumask *src2p)
639650 {
640651 bitmap_or(cpumask_bits(dstp), cpumask_bits(src1p),
641652 cpumask_bits(src2p), small_cpumask_bits);
@@ -647,9 +658,9 @@ static inline void cpumask_or(struct cpumask *dstp, const struct cpumask *src1p, · 5 unmodified lines
647658 * @src1p: the first input
648659 * @src2p: the second input
649660 */
650−static inline void cpumask_xor(struct cpumask *dstp,
651− const struct cpumask *src1p,
652− const struct cpumask *src2p)
661+static __always_inline
662+void cpumask_xor(struct cpumask *dstp, const struct cpumask *src1p,
663+ const struct cpumask *src2p)
653664 {
654665 bitmap_xor(cpumask_bits(dstp), cpumask_bits(src1p),
655666 cpumask_bits(src2p), small_cpumask_bits);
@@ -663,9 +674,9 @@ static inline void cpumask_xor(struct cpumask *dstp, · 7 unmodified lines
663674 *
664675 * Return: false if *@dstp is empty, else returns true
665676 */
666−static inline bool cpumask_andnot(struct cpumask *dstp,
667− const struct cpumask *src1p,
668− const struct cpumask *src2p)
677+static __always_inline
678+bool cpumask_andnot(struct cpumask *dstp, const struct cpumask *src1p,
679+ const struct cpumask *src2p)
669680 {
670681 return bitmap_andnot(cpumask_bits(dstp), cpumask_bits(src1p),
671682 cpumask_bits(src2p), small_cpumask_bits);
@@ -678,8 +689,8 @@ static inline bool cpumask_andnot(struct cpumask *dstp, · 6 unmodified lines
678689 *
679690 * Return: true if the cpumasks are equal, false if not
680691 */
681−static inline bool cpumask_equal(const struct cpumask *src1p,
682− const struct cpumask *src2p)
692+static __always_inline
693+bool cpumask_equal(const struct cpumask *src1p, const struct cpumask *src2p)
683694 {
684695 return bitmap_equal(cpumask_bits(src1p), cpumask_bits(src2p),
685696 small_cpumask_bits);
@@ -694,9 +705,9 @@ static inline bool cpumask_equal(const struct cpumask *src1p, · 8 unmodified lines
694705 * Return: true if first cpumask ORed with second cpumask == third cpumask,
695706 * otherwise false
696707 */
697−static inline bool cpumask_or_equal(const struct cpumask *src1p,
698− const struct cpumask *src2p,
699− const struct cpumask *src3p)
708+static __always_inline
709+bool cpumask_or_equal(const struct cpumask *src1p, const struct cpumask *src2p,
710+ const struct cpumask *src3p)
700711 {
701712 return bitmap_or_equal(cpumask_bits(src1p), cpumask_bits(src2p),
702713 cpumask_bits(src3p), small_cpumask_bits);
@@ -710,8 +721,8 @@ static inline bool cpumask_or_equal(const struct cpumask *src1p, · 7 unmodified lines
710721 * Return: true if first cpumask ANDed with second cpumask is non-empty,
711722 * otherwise false
712723 */
713−static inline bool cpumask_intersects(const struct cpumask *src1p,
714− const struct cpumask *src2p)
724+static __always_inline
725+bool cpumask_intersects(const struct cpumask *src1p, const struct cpumask *src2p)
715726 {
716727 return bitmap_intersects(cpumask_bits(src1p), cpumask_bits(src2p),
717728 small_cpumask_bits);
@@ -724,8 +735,8 @@ static inline bool cpumask_intersects(const struct cpumask *src1p, · 6 unmodified lines
724735 *
725736 * Return: true if *@src1p is a subset of *@src2p, else returns false
726737 */
727−static inline bool cpumask_subset(const struct cpumask *src1p,
728− const struct cpumask *src2p)
738+static __always_inline
739+bool cpumask_subset(const struct cpumask *src1p, const struct cpumask *src2p)
729740 {
730741 return bitmap_subset(cpumask_bits(src1p), cpumask_bits(src2p),
731742 small_cpumask_bits);
@@ -737,7 +748,7 @@ static inline bool cpumask_subset(const struct cpumask *src1p, · 5 unmodified lines
737748 *
738749 * Return: true if srcp is empty (has no bits set), else false
739750 */
740−static inline bool cpumask_empty(const struct cpumask *srcp)
751+static __always_inline bool cpumask_empty(const struct cpumask *srcp)
741752 {
742753 return bitmap_empty(cpumask_bits(srcp), small_cpumask_bits);
743754 }
@@ -748,7 +759,7 @@ static inline bool cpumask_empty(const struct cpumask *srcp) · 4 unmodified lines
748759 *
749760 * Return: true if srcp is full (has all bits set), else false
750761 */
751−static inline bool cpumask_full(const struct cpumask *srcp)
762+static __always_inline bool cpumask_full(const struct cpumask *srcp)
752763 {
753764 return bitmap_full(cpumask_bits(srcp), nr_cpumask_bits);
754765 }
@@ -759,7 +770,7 @@ static inline bool cpumask_full(const struct cpumask *srcp) · 4 unmodified lines
759770 *
760771 * Return: count of bits set in *srcp
761772 */
762−static inline unsigned int cpumask_weight(const struct cpumask *srcp)
773+static __always_inline unsigned int cpumask_weight(const struct cpumask *srcp)
763774 {
764775 return bitmap_weight(cpumask_bits(srcp), small_cpumask_bits);
765776 }
@@ -771,8 +782,8 @@ static inline unsigned int cpumask_weight(const struct cpumask *srcp) · 5 unmodified lines
771782 *
772783 * Return: count of bits set in both *srcp1 and *srcp2
773784 */
774−static inline unsigned int cpumask_weight_and(const struct cpumask *srcp1,
775− const struct cpumask *srcp2)
785+static __always_inline
786+unsigned int cpumask_weight_and(const struct cpumask *srcp1, const struct cpumask *srcp2)
776787 {
777788 return bitmap_weight_and(cpumask_bits(srcp1), cpumask_bits(srcp2), small_cpumask_bits);
778789 }
@@ -784,8 +795,9 @@ static inline unsigned int cpumask_weight_and(const struct cpumask *srcp1, · 5 unmodified lines
784795 *
785796 * Return: count of bits set in both *srcp1 and *srcp2
786797 */
787−static inline unsigned int cpumask_weight_andnot(const struct cpumask *srcp1,
788− const struct cpumask *srcp2)
798+static __always_inline
799+unsigned int cpumask_weight_andnot(const struct cpumask *srcp1,
800+ const struct cpumask *srcp2)
789801 {
790802 return bitmap_weight_andnot(cpumask_bits(srcp1), cpumask_bits(srcp2), small_cpumask_bits);
791803 }
@@ -796,8 +808,8 @@ static inline unsigned int cpumask_weight_andnot(const struct cpumask *srcp1, · 4 unmodified lines
796808 * @srcp: the input to shift
797809 * @n: the number of bits to shift by
798810 */
799−static inline void cpumask_shift_right(struct cpumask *dstp,
800− const struct cpumask *srcp, int n)
811+static __always_inline
812+void cpumask_shift_right(struct cpumask *dstp, const struct cpumask *srcp, int n)
801813 {
802814 bitmap_shift_right(cpumask_bits(dstp), cpumask_bits(srcp), n,
803815 small_cpumask_bits);
@@ -809,8 +821,8 @@ static inline void cpumask_shift_right(struct cpumask *dstp, · 5 unmodified lines
809821 * @srcp: the input to shift
810822 * @n: the number of bits to shift by
811823 */
812−static inline void cpumask_shift_left(struct cpumask *dstp,
813− const struct cpumask *srcp, int n)
824+static __always_inline
825+void cpumask_shift_left(struct cpumask *dstp, const struct cpumask *srcp, int n)
814826 {
815827 bitmap_shift_left(cpumask_bits(dstp), cpumask_bits(srcp), n,
816828 nr_cpumask_bits);
@@ -821,8 +833,8 @@ static inline void cpumask_shift_left(struct cpumask *dstp, · 4 unmodified lines
821833 * @dstp: the result
822834 * @srcp: the input cpumask
823835 */
824−static inline void cpumask_copy(struct cpumask *dstp,
825− const struct cpumask *srcp)
836+static __always_inline
837+void cpumask_copy(struct cpumask *dstp, const struct cpumask *srcp)
826838 {
827839 bitmap_copy(cpumask_bits(dstp), cpumask_bits(srcp), large_cpumask_bits);
828840 }
@@ -858,8 +870,8 @@ static inline void cpumask_copy(struct cpumask *dstp, · 29 unmodified lines
858870 *
859871 * Return: -errno, or 0 for success.
860872 */
861−static inline int cpumask_parse_user(const char __user *buf, int len,
862− struct cpumask *dstp)
873+static __always_inline
874+int cpumask_parse_user(const char __user *buf, int len, struct cpumask *dstp)
863875 {
864876 return bitmap_parse_user(buf, len, cpumask_bits(dstp), nr_cpumask_bits);
865877 }
@@ -872,8 +884,8 @@ static inline int cpumask_parse_user(const char __user *buf, int len, · 6 unmodified lines
872884 *
873885 * Return: -errno, or 0 for success.
874886 */
875−static inline int cpumask_parselist_user(const char __user *buf, int len,
876− struct cpumask *dstp)
887+static __always_inline
888+int cpumask_parselist_user(const char __user *buf, int len, struct cpumask *dstp)
877889 {
878890 return bitmap_parselist_user(buf, len, cpumask_bits(dstp),
879891 nr_cpumask_bits);
@@ -886,7 +898,7 @@ static inline int cpumask_parselist_user(const char __user *buf, int len, · 6 unmodified lines
886898 *
887899 * Return: -errno, or 0 for success.
888900 */
889−static inline int cpumask_parse(const char *buf, struct cpumask *dstp)
901+static __always_inline int cpumask_parse(const char *buf, struct cpumask *dstp)
890902 {
891903 return bitmap_parse(buf, UINT_MAX, cpumask_bits(dstp), nr_cpumask_bits);
892904 }
@@ -898,7 +910,7 @@ static inline int cpumask_parse(const char *buf, struct cpumask *dstp) · 5 unmodified lines
898910 *
899911 * Return: -errno, or 0 for success.
900912 */
901−static inline int cpulist_parse(const char *buf, struct cpumask *dstp)
913+static __always_inline int cpulist_parse(const char *buf, struct cpumask *dstp)
902914 {
903915 return bitmap_parselist(buf, cpumask_bits(dstp), nr_cpumask_bits);
904916 }
@@ -908,7 +920,7 @@ static inline int cpulist_parse(const char *buf, struct cpumask *dstp) · 3 unmodified lines
908920 *
909921 * Return: size to allocate for a &struct cpumask in bytes
910922 */
911−static inline unsigned int cpumask_size(void)
923+static __always_inline unsigned int cpumask_size(void)
912924 {
913925 return bitmap_size(large_cpumask_bits);
914926 }
@@ -920,7 +932,7 @@ static inline unsigned int cpumask_size(void) · 5 unmodified lines
920932
921933 bool alloc_cpumask_var_node(cpumask_var_t *mask, gfp_t flags, int node);
922934
923−static inline
935+static __always_inline
924936 bool zalloc_cpumask_var_node(cpumask_var_t *mask, gfp_t flags, int node)
925937 {
926938 return alloc_cpumask_var_node(mask, flags | __GFP_ZERO, node);
@@ -938,13 +950,13 @@ bool zalloc_cpumask_var_node(cpumask_var_t *mask, gfp_t flags, int node) · 11 unmodified lines
938950 *
939951 * Return: %true if allocation succeeded, %false if not
940952 */
941−static inline
953+static __always_inline
942954 bool alloc_cpumask_var(cpumask_var_t *mask, gfp_t flags)
943955 {
944956 return alloc_cpumask_var_node(mask, flags, NUMA_NO_NODE);
945957 }
946958
947−static inline
959+static __always_inline
948960 bool zalloc_cpumask_var(cpumask_var_t *mask, gfp_t flags)
949961 {
950962 return alloc_cpumask_var(mask, flags | __GFP_ZERO);
@@ -954,7 +966,7 @@ void alloc_bootmem_cpumask_var(cpumask_var_t *mask); · 3 unmodified lines
954966 void free_cpumask_var(cpumask_var_t mask);
955967 void free_bootmem_cpumask_var(cpumask_var_t mask);
956968
957−static inline bool cpumask_available(cpumask_var_t mask)
969+static __always_inline bool cpumask_available(cpumask_var_t mask)
958970 {
959971 return mask != NULL;
960972 }
@@ -964,43 +976,43 @@ static inline bool cpumask_available(cpumask_var_t mask) · 3 unmodified lines
964976 #define this_cpu_cpumask_var_ptr(x) this_cpu_ptr(x)
965977 #define __cpumask_var_read_mostly
966978
967−static inline bool alloc_cpumask_var(cpumask_var_t *mask, gfp_t flags)
979+static __always_inline bool alloc_cpumask_var(cpumask_var_t *mask, gfp_t flags)
968980 {
969981 return true;
970982 }
971983
972−static inline bool alloc_cpumask_var_node(cpumask_var_t *mask, gfp_t flags,
984+static __always_inline bool alloc_cpumask_var_node(cpumask_var_t *mask, gfp_t flags,
973985 int node)
974986 {
975987 return true;
976988 }
977989
978−static inline bool zalloc_cpumask_var(cpumask_var_t *mask, gfp_t flags)
990+static __always_inline bool zalloc_cpumask_var(cpumask_var_t *mask, gfp_t flags)
979991 {
980992 cpumask_clear(*mask);
981993 return true;
982994 }
983995
984−static inline bool zalloc_cpumask_var_node(cpumask_var_t *mask, gfp_t flags,
996+static __always_inline bool zalloc_cpumask_var_node(cpumask_var_t *mask, gfp_t flags,
985997 int node)
986998 {
987999 cpumask_clear(*mask);
9881000 return true;
9891001 }
9901002
991−static inline void alloc_bootmem_cpumask_var(cpumask_var_t *mask)
1003+static __always_inline void alloc_bootmem_cpumask_var(cpumask_var_t *mask)
9921004 {
9931005 }
9941006
995−static inline void free_cpumask_var(cpumask_var_t mask)
1007+static __always_inline void free_cpumask_var(cpumask_var_t mask)
9961008 {
9971009 }
9981010
999−static inline void free_bootmem_cpumask_var(cpumask_var_t mask)
1011+static __always_inline void free_bootmem_cpumask_var(cpumask_var_t mask)
10001012 {
10011013 }
10021014
1003−static inline bool cpumask_available(cpumask_var_t mask)
1015+static __always_inline bool cpumask_available(cpumask_var_t mask)
10041016 {
10051017 return true;
10061018 }
@@ -1058,7 +1070,7 @@ void set_cpu_online(unsigned int cpu, bool online); · 51 unmodified lines
10581070 ((struct cpumask *)(1 ? (bitmap) \
10591071 : (void *)sizeof(__check_is_bitmap(bitmap))))
10601072
1061−static inline int __check_is_bitmap(const unsigned long *bitmap)
1073+static __always_inline int __check_is_bitmap(const unsigned long *bitmap)
10621074 {
10631075 return 1;
10641076 }
@@ -1073,7 +1085,7 @@ static inline int __check_is_bitmap(const unsigned long *bitmap) · 8 unmodified lines
10731085 extern const unsigned long
10741086 cpu_bit_bitmap[BITS_PER_LONG+1][BITS_TO_LONGS(NR_CPUS)];
10751087
1076−static inline const struct cpumask *get_cpu_mask(unsigned int cpu)
1088+static __always_inline const struct cpumask *get_cpu_mask(unsigned int cpu)
10771089 {
10781090 const unsigned long *p = cpu_bit_bitmap[1 + cpu % BITS_PER_LONG];
10791091 p -= cpu / BITS_PER_LONG;
@@ -1100,32 +1112,32 @@ static __always_inline unsigned int num_online_cpus(void) · 20 unmodified lines
11001112 #define num_present_cpus() cpumask_weight(cpu_present_mask)
11011113 #define num_active_cpus() cpumask_weight(cpu_active_mask)
11021114
1103−static inline bool cpu_online(unsigned int cpu)
1115+static __always_inline bool cpu_online(unsigned int cpu)
11041116 {
11051117 return cpumask_test_cpu(cpu, cpu_online_mask);
11061118 }
11071119
1108−static inline bool cpu_enabled(unsigned int cpu)
1120+static __always_inline bool cpu_enabled(unsigned int cpu)
11091121 {
11101122 return cpumask_test_cpu(cpu, cpu_enabled_mask);
11111123 }
11121124
1113−static inline bool cpu_possible(unsigned int cpu)
1125+static __always_inline bool cpu_possible(unsigned int cpu)
11141126 {
11151127 return cpumask_test_cpu(cpu, cpu_possible_mask);
11161128 }
11171129
1118−static inline bool cpu_present(unsigned int cpu)
1130+static __always_inline bool cpu_present(unsigned int cpu)
11191131 {
11201132 return cpumask_test_cpu(cpu, cpu_present_mask);
11211133 }
11221134
1123−static inline bool cpu_active(unsigned int cpu)
1135+static __always_inline bool cpu_active(unsigned int cpu)
11241136 {
11251137 return cpumask_test_cpu(cpu, cpu_active_mask);
11261138 }
11271139
1128−static inline bool cpu_dying(unsigned int cpu)
1140+static __always_inline bool cpu_dying(unsigned int cpu)
11291141 {
11301142 return cpumask_test_cpu(cpu, cpu_dying_mask);
11311143 }
@@ -1138,32 +1150,32 @@ static inline bool cpu_dying(unsigned int cpu) · 6 unmodified lines
11381150 #define num_present_cpus() 1U
11391151 #define num_active_cpus() 1U
11401152
1141−static inline bool cpu_online(unsigned int cpu)
1153+static __always_inline bool cpu_online(unsigned int cpu)
11421154 {
11431155 return cpu == 0;
11441156 }
11451157
1146−static inline bool cpu_possible(unsigned int cpu)
1158+static __always_inline bool cpu_possible(unsigned int cpu)
11471159 {
11481160 return cpu == 0;
11491161 }
11501162
1151−static inline bool cpu_enabled(unsigned int cpu)
1163+static __always_inline bool cpu_enabled(unsigned int cpu)
11521164 {
11531165 return cpu == 0;
11541166 }
11551167
1156−static inline bool cpu_present(unsigned int cpu)
1168+static __always_inline bool cpu_present(unsigned int cpu)
11571169 {
11581170 return cpu == 0;
11591171 }
11601172
1161−static inline bool cpu_active(unsigned int cpu)
1173+static __always_inline bool cpu_active(unsigned int cpu)
11621174 {
11631175 return cpu == 0;
11641176 }
11651177
1166−static inline bool cpu_dying(unsigned int cpu)
1178+static __always_inline bool cpu_dying(unsigned int cpu)
11671179 {
11681180 return false;
11691181 }
@@ -1197,7 +1209,7 @@ static inline bool cpu_dying(unsigned int cpu) · 27 unmodified lines
11971209 * Return: the length of the (null-terminated) @buf string, zero if
11981210 * nothing is copied.
11991211 */
1200−static inline ssize_t
1212+static __always_inline ssize_t
12011213 cpumap_print_to_pagebuf(bool list, char *buf, const struct cpumask *mask)
12021214 {
12031215 return bitmap_print_to_pagebuf(list, buf, cpumask_bits(mask),
@@ -1220,9 +1232,9 @@ cpumap_print_to_pagebuf(bool list, char *buf, const struct cpumask *mask) · 16 unmodified lines
12201232 * Return: the length of how many bytes have been copied, excluding
12211233 * terminating '\0'.
12221234 */
1223−static inline ssize_t
1224−cpumap_print_bitmask_to_buf(char *buf, const struct cpumask *mask,
1225− loff_t off, size_t count)
1235+static __always_inline
1236+ssize_t cpumap_print_bitmask_to_buf(char *buf, const struct cpumask *mask,
1237+ loff_t off, size_t count)
12261238 {
12271239 return bitmap_print_bitmask_to_buf(buf, cpumask_bits(mask),
12281240 nr_cpu_ids, off, count) - 1;
@@ -1242,9 +1254,9 @@ cpumap_print_bitmask_to_buf(char *buf, const struct cpumask *mask, · 13 unmodified lines
12421254 * Return: the length of how many bytes have been copied, excluding
12431255 * terminating '\0'.
12441256 */
1245−static inline ssize_t
1246−cpumap_print_list_to_buf(char *buf, const struct cpumask *mask,
1247− loff_t off, size_t count)
1257+static __always_inline
1258+ssize_t cpumap_print_list_to_buf(char *buf, const struct cpumask *mask,
1259+ loff_t off, size_t count)
12481260 {
12491261 return bitmap_print_list_to_buf(buf, cpumask_bits(mask),
12501262 nr_cpu_ids, off, count) - 1;
include/linux/find.h+25−25
@@ -52,7 +52,7 @@ unsigned long _find_next_bit_le(const unsigned long *addr, unsigned · 51 unmodified lines
5252 * Returns the bit number for the next set bit
5353 * If no bits are set, returns @size.
5454 */
55−static inline
55+static __always_inline
5656 unsigned long find_next_bit(const unsigned long *addr, unsigned long size,
5757 unsigned long offset)
5858 {
@@ -81,7 +81,7 @@ unsigned long find_next_bit(const unsigned long *addr, unsigned long size, · 22 unmodified lines
8181 * Returns the bit number for the next set bit
8282 * If no bits are set, returns @size.
8383 */
84−static inline
84+static __always_inline
8585 unsigned long find_next_and_bit(const unsigned long *addr1,
8686 const unsigned long *addr2, unsigned long size,
8787 unsigned long offset)
@@ -112,7 +112,7 @@ unsigned long find_next_and_bit(const unsigned long *addr1, · 24 unmodified lines
112112 * Returns the bit number for the next set bit
113113 * If no bits are set, returns @size.
114114 */
115−static inline
115+static __always_inline
116116 unsigned long find_next_andnot_bit(const unsigned long *addr1,
117117 const unsigned long *addr2, unsigned long size,
118118 unsigned long offset)
@@ -142,7 +142,7 @@ unsigned long find_next_andnot_bit(const unsigned long *addr1, · 23 unmodified lines
142142 * Returns the bit number for the next set bit
143143 * If no bits are set, returns @size.
144144 */
145−static inline
145+static __always_inline
146146 unsigned long find_next_or_bit(const unsigned long *addr1,
147147 const unsigned long *addr2, unsigned long size,
148148 unsigned long offset)
@@ -171,7 +171,7 @@ unsigned long find_next_or_bit(const unsigned long *addr1, · 22 unmodified lines
171171 * Returns the bit number of the next zero bit
172172 * If no bits are zero, returns @size.
173173 */
174−static inline
174+static __always_inline
175175 unsigned long find_next_zero_bit(const unsigned long *addr, unsigned long size,
176176 unsigned long offset)
177177 {
@@ -198,7 +198,7 @@ unsigned long find_next_zero_bit(const unsigned long *addr, unsigned long size, · 20 unmodified lines
198198 * Returns the bit number of the first set bit.
199199 * If no bits are set, returns @size.
200200 */
201−static inline
201+static __always_inline
202202 unsigned long find_first_bit(const unsigned long *addr, unsigned long size)
203203 {
204204 if (small_const_nbits(size)) {
@@ -224,7 +224,7 @@ unsigned long find_first_bit(const unsigned long *addr, unsigned long size) · 19 unmodified lines
224224 * Returns the bit number of the N'th set bit.
225225 * If no such, returns >= @size.
226226 */
227−static inline
227+static __always_inline
228228 unsigned long find_nth_bit(const unsigned long *addr, unsigned long size, unsigned long n)
229229 {
230230 if (n >= size)
@@ -249,7 +249,7 @@ unsigned long find_nth_bit(const unsigned long *addr, unsigned long size, unsign · 18 unmodified lines
249249 * Returns the bit number of the N'th set bit.
250250 * If no such, returns @size.
251251 */
252−static inline
252+static __always_inline
253253 unsigned long find_nth_and_bit(const unsigned long *addr1, const unsigned long *addr2,
254254 unsigned long size, unsigned long n)
255255 {
@@ -276,7 +276,7 @@ unsigned long find_nth_and_bit(const unsigned long *addr1, const unsigned long * · 20 unmodified lines
276276 * Returns the bit number of the N'th set bit.
277277 * If no such, returns @size.
278278 */
279−static inline
279+static __always_inline
280280 unsigned long find_nth_andnot_bit(const unsigned long *addr1, const unsigned long *addr2,
281281 unsigned long size, unsigned long n)
282282 {
@@ -332,7 +332,7 @@ unsigned long find_nth_and_andnot_bit(const unsigned long *addr1, · 49 unmodified lines
332332 * Returns the bit number for the next set bit
333333 * If no bits are set, returns @size.
334334 */
335−static inline
335+static __always_inline
336336 unsigned long find_first_and_bit(const unsigned long *addr1,
337337 const unsigned long *addr2,
338338 unsigned long size)
@@ -357,7 +357,7 @@ unsigned long find_first_and_bit(const unsigned long *addr1, · 18 unmodified lines
357357 * Returns the bit number for the first set bit
358358 * If no bits are set, returns @size.
359359 */
360−static inline
360+static __always_inline
361361 unsigned long find_first_and_and_bit(const unsigned long *addr1,
362362 const unsigned long *addr2,
363363 const unsigned long *addr3,
@@ -381,7 +381,7 @@ unsigned long find_first_and_and_bit(const unsigned long *addr1, · 17 unmodified lines
381381 * Returns the bit number of the first cleared bit.
382382 * If no bits are zero, returns @size.
383383 */
384−static inline
384+static __always_inline
385385 unsigned long find_first_zero_bit(const unsigned long *addr, unsigned long size)
386386 {
387387 if (small_const_nbits(size)) {
@@ -402,7 +402,7 @@ unsigned long find_first_zero_bit(const unsigned long *addr, unsigned long size) · 14 unmodified lines
402402 *
403403 * Returns the bit number of the last set bit, or size.
404404 */
405−static inline
405+static __always_inline
406406 unsigned long find_last_bit(const unsigned long *addr, unsigned long size)
407407 {
408408 if (small_const_nbits(size)) {
@@ -425,7 +425,7 @@ unsigned long find_last_bit(const unsigned long *addr, unsigned long size) · 16 unmodified lines
425425 * Returns the bit number for the next set bit, or first set bit up to @offset
426426 * If no bits are set, returns @size.
427427 */
428−static inline
428+static __always_inline
429429 unsigned long find_next_and_bit_wrap(const unsigned long *addr1,
430430 const unsigned long *addr2,
431431 unsigned long size, unsigned long offset)
@@ -448,7 +448,7 @@ unsigned long find_next_and_bit_wrap(const unsigned long *addr1, · 16 unmodified lines
448448 * Returns the bit number for the next set bit, or first set bit up to @offset
449449 * If no bits are set, returns @size.
450450 */
451−static inline
451+static __always_inline
452452 unsigned long find_next_bit_wrap(const unsigned long *addr,
453453 unsigned long size, unsigned long offset)
454454 {
@@ -465,7 +465,7 @@ unsigned long find_next_bit_wrap(const unsigned long *addr, · 10 unmodified lines
465465 * Helper for for_each_set_bit_wrap(). Make sure you're doing right thing
466466 * before using it alone.
467467 */
468−static inline
468+static __always_inline
469469 unsigned long __for_each_wrap(const unsigned long *bitmap, unsigned long size,
470470 unsigned long start, unsigned long n)
471471 {
@@ -506,20 +506,20 @@ extern unsigned long find_next_clump8(unsigned long *clump, · 34 unmodified lines
506506
507507 #if defined(__LITTLE_ENDIAN)
508508
509−static inline unsigned long find_next_zero_bit_le(const void *addr,
510− unsigned long size, unsigned long offset)
509+static __always_inline
510+unsigned long find_next_zero_bit_le(const void *addr, unsigned long size, unsigned long offset)
511511 {
512512 return find_next_zero_bit(addr, size, offset);
513513 }
514514
515−static inline unsigned long find_next_bit_le(const void *addr,
516− unsigned long size, unsigned long offset)
515+static __always_inline
516+unsigned long find_next_bit_le(const void *addr, unsigned long size, unsigned long offset)
517517 {
518518 return find_next_bit(addr, size, offset);
519519 }
520520
521−static inline unsigned long find_first_zero_bit_le(const void *addr,
522− unsigned long size)
521+static __always_inline
522+unsigned long find_first_zero_bit_le(const void *addr, unsigned long size)
523523 {
524524 return find_first_zero_bit(addr, size);
525525 }
@@ -527,7 +527,7 @@ static inline unsigned long find_first_zero_bit_le(const void *addr, · 1 unmodified line
527527 #elif defined(__BIG_ENDIAN)
528528
529529 #ifndef find_next_zero_bit_le
530−static inline
530+static __always_inline
531531 unsigned long find_next_zero_bit_le(const void *addr, unsigned
532532 long size, unsigned long offset)
533533 {
@@ -546,7 +546,7 @@ unsigned long find_next_zero_bit_le(const void *addr, unsigned · 12 unmodified lines
546546 #endif
547547
548548 #ifndef find_first_zero_bit_le
549−static inline
549+static __always_inline
550550 unsigned long find_first_zero_bit_le(const void *addr, unsigned long size)
551551 {
552552 if (small_const_nbits(size)) {
@@ -560,7 +560,7 @@ unsigned long find_first_zero_bit_le(const void *addr, unsigned long size) · 7 unmodified lines
560560 #endif
561561
562562 #ifndef find_next_bit_le
563−static inline
563+static __always_inline
564564 unsigned long find_next_bit_le(const void *addr, unsigned
565565 long size, unsigned long offset)
566566 {
include/linux/nodemask.h+43−43
@@ -107,11 +107,11 @@ extern nodemask_t _unused_nodemask_arg_; · 106 unmodified lines
107107 */
108108 #define nodemask_pr_args(maskp) __nodemask_pr_numnodes(maskp), \
109109 __nodemask_pr_bits(maskp)
110−static inline unsigned int __nodemask_pr_numnodes(const nodemask_t *m)
110+static __always_inline unsigned int __nodemask_pr_numnodes(const nodemask_t *m)
111111 {
112112 return m ? MAX_NUMNODES : 0;
113113 }
114−static inline const unsigned long *__nodemask_pr_bits(const nodemask_t *m)
114+static __always_inline const unsigned long *__nodemask_pr_bits(const nodemask_t *m)
115115 {
116116 return m ? m->bits : NULL;
117117 }
@@ -132,19 +132,19 @@ static __always_inline void __node_set(int node, volatile nodemask_t *dstp) · 14 unmodified lines
132132 }
133133
134134 #define node_clear(node, dst) __node_clear((node), &(dst))
135−static inline void __node_clear(int node, volatile nodemask_t *dstp)
135+static __always_inline void __node_clear(int node, volatile nodemask_t *dstp)
136136 {
137137 clear_bit(node, dstp->bits);
138138 }
139139
140140 #define nodes_setall(dst) __nodes_setall(&(dst), MAX_NUMNODES)
141−static inline void __nodes_setall(nodemask_t *dstp, unsigned int nbits)
141+static __always_inline void __nodes_setall(nodemask_t *dstp, unsigned int nbits)
142142 {
143143 bitmap_fill(dstp->bits, nbits);
144144 }
145145
146146 #define nodes_clear(dst) __nodes_clear(&(dst), MAX_NUMNODES)
147−static inline void __nodes_clear(nodemask_t *dstp, unsigned int nbits)
147+static __always_inline void __nodes_clear(nodemask_t *dstp, unsigned int nbits)
148148 {
149149 bitmap_zero(dstp->bits, nbits);
150150 }
@@ -154,14 +154,14 @@ static inline void __nodes_clear(nodemask_t *dstp, unsigned int nbits) · 3 unmodified lines
154154
155155 #define node_test_and_set(node, nodemask) \
156156 __node_test_and_set((node), &(nodemask))
157−static inline bool __node_test_and_set(int node, nodemask_t *addr)
157+static __always_inline bool __node_test_and_set(int node, nodemask_t *addr)
158158 {
159159 return test_and_set_bit(node, addr->bits);
160160 }
161161
162162 #define nodes_and(dst, src1, src2) \
163163 __nodes_and(&(dst), &(src1), &(src2), MAX_NUMNODES)
164−static inline void __nodes_and(nodemask_t *dstp, const nodemask_t *src1p,
164+static __always_inline void __nodes_and(nodemask_t *dstp, const nodemask_t *src1p,
165165 const nodemask_t *src2p, unsigned int nbits)
166166 {
167167 bitmap_and(dstp->bits, src1p->bits, src2p->bits, nbits);
@@ -169,7 +169,7 @@ static inline void __nodes_and(nodemask_t *dstp, const nodemask_t *src1p, · 1 unmodified line
169169
170170 #define nodes_or(dst, src1, src2) \
171171 __nodes_or(&(dst), &(src1), &(src2), MAX_NUMNODES)
172−static inline void __nodes_or(nodemask_t *dstp, const nodemask_t *src1p,
172+static __always_inline void __nodes_or(nodemask_t *dstp, const nodemask_t *src1p,
173173 const nodemask_t *src2p, unsigned int nbits)
174174 {
175175 bitmap_or(dstp->bits, src1p->bits, src2p->bits, nbits);
@@ -177,7 +177,7 @@ static inline void __nodes_or(nodemask_t *dstp, const nodemask_t *src1p, · 1 unmodified line
177177
178178 #define nodes_xor(dst, src1, src2) \
179179 __nodes_xor(&(dst), &(src1), &(src2), MAX_NUMNODES)
180−static inline void __nodes_xor(nodemask_t *dstp, const nodemask_t *src1p,
180+static __always_inline void __nodes_xor(nodemask_t *dstp, const nodemask_t *src1p,
181181 const nodemask_t *src2p, unsigned int nbits)
182182 {
183183 bitmap_xor(dstp->bits, src1p->bits, src2p->bits, nbits);
@@ -185,7 +185,7 @@ static inline void __nodes_xor(nodemask_t *dstp, const nodemask_t *src1p, · 1 unmodified line
185185
186186 #define nodes_andnot(dst, src1, src2) \
187187 __nodes_andnot(&(dst), &(src1), &(src2), MAX_NUMNODES)
188−static inline void __nodes_andnot(nodemask_t *dstp, const nodemask_t *src1p,
188+static __always_inline void __nodes_andnot(nodemask_t *dstp, const nodemask_t *src1p,
189189 const nodemask_t *src2p, unsigned int nbits)
190190 {
191191 bitmap_andnot(dstp->bits, src1p->bits, src2p->bits, nbits);
@@ -193,7 +193,7 @@ static inline void __nodes_andnot(nodemask_t *dstp, const nodemask_t *src1p, · 1 unmodified line
193193
194194 #define nodes_complement(dst, src) \
195195 __nodes_complement(&(dst), &(src), MAX_NUMNODES)
196−static inline void __nodes_complement(nodemask_t *dstp,
196+static __always_inline void __nodes_complement(nodemask_t *dstp,
197197 const nodemask_t *srcp, unsigned int nbits)
198198 {
199199 bitmap_complement(dstp->bits, srcp->bits, nbits);
@@ -201,7 +201,7 @@ static inline void __nodes_complement(nodemask_t *dstp, · 1 unmodified line
201201
202202 #define nodes_equal(src1, src2) \
203203 __nodes_equal(&(src1), &(src2), MAX_NUMNODES)
204−static inline bool __nodes_equal(const nodemask_t *src1p,
204+static __always_inline bool __nodes_equal(const nodemask_t *src1p,
205205 const nodemask_t *src2p, unsigned int nbits)
206206 {
207207 return bitmap_equal(src1p->bits, src2p->bits, nbits);
@@ -209,7 +209,7 @@ static inline bool __nodes_equal(const nodemask_t *src1p, · 1 unmodified line
209209
210210 #define nodes_intersects(src1, src2) \
211211 __nodes_intersects(&(src1), &(src2), MAX_NUMNODES)
212−static inline bool __nodes_intersects(const nodemask_t *src1p,
212+static __always_inline bool __nodes_intersects(const nodemask_t *src1p,
213213 const nodemask_t *src2p, unsigned int nbits)
214214 {
215215 return bitmap_intersects(src1p->bits, src2p->bits, nbits);
@@ -217,33 +217,33 @@ static inline bool __nodes_intersects(const nodemask_t *src1p, · 1 unmodified line
217217
218218 #define nodes_subset(src1, src2) \
219219 __nodes_subset(&(src1), &(src2), MAX_NUMNODES)
220−static inline bool __nodes_subset(const nodemask_t *src1p,
220+static __always_inline bool __nodes_subset(const nodemask_t *src1p,
221221 const nodemask_t *src2p, unsigned int nbits)
222222 {
223223 return bitmap_subset(src1p->bits, src2p->bits, nbits);
224224 }
225225
226226 #define nodes_empty(src) __nodes_empty(&(src), MAX_NUMNODES)
227−static inline bool __nodes_empty(const nodemask_t *srcp, unsigned int nbits)
227+static __always_inline bool __nodes_empty(const nodemask_t *srcp, unsigned int nbits)
228228 {
229229 return bitmap_empty(srcp->bits, nbits);
230230 }
231231
232232 #define nodes_full(nodemask) __nodes_full(&(nodemask), MAX_NUMNODES)
233−static inline bool __nodes_full(const nodemask_t *srcp, unsigned int nbits)
233+static __always_inline bool __nodes_full(const nodemask_t *srcp, unsigned int nbits)
234234 {
235235 return bitmap_full(srcp->bits, nbits);
236236 }
237237
238238 #define nodes_weight(nodemask) __nodes_weight(&(nodemask), MAX_NUMNODES)
239−static inline int __nodes_weight(const nodemask_t *srcp, unsigned int nbits)
239+static __always_inline int __nodes_weight(const nodemask_t *srcp, unsigned int nbits)
240240 {
241241 return bitmap_weight(srcp->bits, nbits);
242242 }
243243
244244 #define nodes_shift_right(dst, src, n) \
245245 __nodes_shift_right(&(dst), &(src), (n), MAX_NUMNODES)
246−static inline void __nodes_shift_right(nodemask_t *dstp,
246+static __always_inline void __nodes_shift_right(nodemask_t *dstp,
247247 const nodemask_t *srcp, int n, int nbits)
248248 {
249249 bitmap_shift_right(dstp->bits, srcp->bits, n, nbits);
@@ -251,7 +251,7 @@ static inline void __nodes_shift_right(nodemask_t *dstp, · 1 unmodified line
251251
252252 #define nodes_shift_left(dst, src, n) \
253253 __nodes_shift_left(&(dst), &(src), (n), MAX_NUMNODES)
254−static inline void __nodes_shift_left(nodemask_t *dstp,
254+static __always_inline void __nodes_shift_left(nodemask_t *dstp,
255255 const nodemask_t *srcp, int n, int nbits)
256256 {
257257 bitmap_shift_left(dstp->bits, srcp->bits, n, nbits);
@@ -261,13 +261,13 @@ static inline void __nodes_shift_left(nodemask_t *dstp, · 3 unmodified lines
261261 > MAX_NUMNODES, then the silly min_ts could be dropped. */
262262
263263 #define first_node(src) __first_node(&(src))
264−static inline unsigned int __first_node(const nodemask_t *srcp)
264+static __always_inline unsigned int __first_node(const nodemask_t *srcp)
265265 {
266266 return min_t(unsigned int, MAX_NUMNODES, find_first_bit(srcp->bits, MAX_NUMNODES));
267267 }
268268
269269 #define next_node(n, src) __next_node((n), &(src))
270−static inline unsigned int __next_node(int n, const nodemask_t *srcp)
270+static __always_inline unsigned int __next_node(int n, const nodemask_t *srcp)
271271 {
272272 return min_t(unsigned int, MAX_NUMNODES, find_next_bit(srcp->bits, MAX_NUMNODES, n+1));
273273 }
@@ -277,7 +277,7 @@ static inline unsigned int __next_node(int n, const nodemask_t *srcp) · 3 unmodified lines
277277 * the first node in src if needed. Returns MAX_NUMNODES if src is empty.
278278 */
279279 #define next_node_in(n, src) __next_node_in((n), &(src))
280−static inline unsigned int __next_node_in(int node, const nodemask_t *srcp)
280+static __always_inline unsigned int __next_node_in(int node, const nodemask_t *srcp)
281281 {
282282 unsigned int ret = __next_node(node, srcp);
283283
@@ -286,7 +286,7 @@ static inline unsigned int __next_node_in(int node, const nodemask_t *srcp) · 2 unmodified lines
286286 return ret;
287287 }
288288
289−static inline void init_nodemask_of_node(nodemask_t *mask, int node)
289+static __always_inline void init_nodemask_of_node(nodemask_t *mask, int node)
290290 {
291291 nodes_clear(*mask);
292292 node_set(node, *mask);
@@ -304,7 +304,7 @@ static inline void init_nodemask_of_node(nodemask_t *mask, int node) · 11 unmodified lines
304304 })
305305
306306 #define first_unset_node(mask) __first_unset_node(&(mask))
307−static inline unsigned int __first_unset_node(const nodemask_t *maskp)
307+static __always_inline unsigned int __first_unset_node(const nodemask_t *maskp)
308308 {
309309 return min_t(unsigned int, MAX_NUMNODES,
310310 find_first_zero_bit(maskp->bits, MAX_NUMNODES));
@@ -338,21 +338,21 @@ static inline unsigned int __first_unset_node(const nodemask_t *maskp) · 27 unmodified lines
338338
339339 #define nodemask_parse_user(ubuf, ulen, dst) \
340340 __nodemask_parse_user((ubuf), (ulen), &(dst), MAX_NUMNODES)
341−static inline int __nodemask_parse_user(const char __user *buf, int len,
341+static __always_inline int __nodemask_parse_user(const char __user *buf, int len,
342342 nodemask_t *dstp, int nbits)
343343 {
344344 return bitmap_parse_user(buf, len, dstp->bits, nbits);
345345 }
346346
347347 #define nodelist_parse(buf, dst) __nodelist_parse((buf), &(dst), MAX_NUMNODES)
348−static inline int __nodelist_parse(const char *buf, nodemask_t *dstp, int nbits)
348+static __always_inline int __nodelist_parse(const char *buf, nodemask_t *dstp, int nbits)
349349 {
350350 return bitmap_parselist(buf, dstp->bits, nbits);
351351 }
352352
353353 #define node_remap(oldbit, old, new) \
354354 __node_remap((oldbit), &(old), &(new), MAX_NUMNODES)
355−static inline int __node_remap(int oldbit,
355+static __always_inline int __node_remap(int oldbit,
356356 const nodemask_t *oldp, const nodemask_t *newp, int nbits)
357357 {
358358 return bitmap_bitremap(oldbit, oldp->bits, newp->bits, nbits);
@@ -360,7 +360,7 @@ static inline int __node_remap(int oldbit, · 1 unmodified line
360360
361361 #define nodes_remap(dst, src, old, new) \
362362 __nodes_remap(&(dst), &(src), &(old), &(new), MAX_NUMNODES)
363−static inline void __nodes_remap(nodemask_t *dstp, const nodemask_t *srcp,
363+static __always_inline void __nodes_remap(nodemask_t *dstp, const nodemask_t *srcp,
364364 const nodemask_t *oldp, const nodemask_t *newp, int nbits)
365365 {
366366 bitmap_remap(dstp->bits, srcp->bits, oldp->bits, newp->bits, nbits);
@@ -368,7 +368,7 @@ static inline void __nodes_remap(nodemask_t *dstp, const nodemask_t *srcp, · 1 unmodified line
368368
369369 #define nodes_onto(dst, orig, relmap) \
370370 __nodes_onto(&(dst), &(orig), &(relmap), MAX_NUMNODES)
371−static inline void __nodes_onto(nodemask_t *dstp, const nodemask_t *origp,
371+static __always_inline void __nodes_onto(nodemask_t *dstp, const nodemask_t *origp,
372372 const nodemask_t *relmapp, int nbits)
373373 {
374374 bitmap_onto(dstp->bits, origp->bits, relmapp->bits, nbits);
@@ -376,7 +376,7 @@ static inline void __nodes_onto(nodemask_t *dstp, const nodemask_t *origp, · 1 unmodified line
376376
377377 #define nodes_fold(dst, orig, sz) \
378378 __nodes_fold(&(dst), &(orig), sz, MAX_NUMNODES)
379−static inline void __nodes_fold(nodemask_t *dstp, const nodemask_t *origp,
379+static __always_inline void __nodes_fold(nodemask_t *dstp, const nodemask_t *origp,
380380 int sz, int nbits)
381381 {
382382 bitmap_fold(dstp->bits, origp->bits, sz, nbits);
@@ -418,22 +418,22 @@ enum node_states { · 35 unmodified lines
418418 extern nodemask_t node_states[NR_NODE_STATES];
419419
420420 #if MAX_NUMNODES > 1
421−static inline int node_state(int node, enum node_states state)
421+static __always_inline int node_state(int node, enum node_states state)
422422 {
423423 return node_isset(node, node_states[state]);
424424 }
425425
426−static inline void node_set_state(int node, enum node_states state)
426+static __always_inline void node_set_state(int node, enum node_states state)
427427 {
428428 __node_set(node, &node_states[state]);
429429 }
430430
431−static inline void node_clear_state(int node, enum node_states state)
431+static __always_inline void node_clear_state(int node, enum node_states state)
432432 {
433433 __node_clear(node, &node_states[state]);
434434 }
435435
436−static inline int num_node_state(enum node_states state)
436+static __always_inline int num_node_state(enum node_states state)
437437 {
438438 return nodes_weight(node_states[state]);
439439 }
@@ -443,11 +443,11 @@ static inline int num_node_state(enum node_states state) · 3 unmodified lines
443443
444444 #define first_online_node first_node(node_states[N_ONLINE])
445445 #define first_memory_node first_node(node_states[N_MEMORY])
446−static inline unsigned int next_online_node(int nid)
446+static __always_inline unsigned int next_online_node(int nid)
447447 {
448448 return next_node(nid, node_states[N_ONLINE]);
449449 }
450−static inline unsigned int next_memory_node(int nid)
450+static __always_inline unsigned int next_memory_node(int nid)
451451 {
452452 return next_node(nid, node_states[N_MEMORY]);
453453 }
@@ -455,13 +455,13 @@ static inline unsigned int next_memory_node(int nid) · 1 unmodified line
455455 extern unsigned int nr_node_ids;
456456 extern unsigned int nr_online_nodes;
457457
458−static inline void node_set_online(int nid)
458+static __always_inline void node_set_online(int nid)
459459 {
460460 node_set_state(nid, N_ONLINE);
461461 nr_online_nodes = num_node_state(N_ONLINE);
462462 }
463463
464−static inline void node_set_offline(int nid)
464+static __always_inline void node_set_offline(int nid)
465465 {
466466 node_clear_state(nid, N_ONLINE);
467467 nr_online_nodes = num_node_state(N_ONLINE);
@@ -469,20 +469,20 @@ static inline void node_set_offline(int nid) · 1 unmodified line
469469
470470 #else
471471
472−static inline int node_state(int node, enum node_states state)
472+static __always_inline int node_state(int node, enum node_states state)
473473 {
474474 return node == 0;
475475 }
476476
477−static inline void node_set_state(int node, enum node_states state)
477+static __always_inline void node_set_state(int node, enum node_states state)
478478 {
479479 }
480480
481−static inline void node_clear_state(int node, enum node_states state)
481+static __always_inline void node_clear_state(int node, enum node_states state)
482482 {
483483 }
484484
485−static inline int num_node_state(enum node_states state)
485+static __always_inline int num_node_state(enum node_states state)
486486 {
487487 return 1;
488488 }
@@ -502,7 +502,7 @@ static inline int num_node_state(enum node_states state) · 13 unmodified lines
502502
503503 #endif
504504
505−static inline int node_random(const nodemask_t *maskp)
505+static __always_inline int node_random(const nodemask_t *maskp)
506506 {
507507 #if defined(CONFIG_NUMA) && (MAX_NUMNODES > 1)
508508 int w, bit;
include/uapi/linux/bits.h+3−0
@@ -12,4 +12,7 @@ · 11 unmodified lines
1212 (((~_ULL(0)) - (_ULL(1) << (l)) + 1) & \
1313 (~_ULL(0) >> (__BITS_PER_LONG_LONG - 1 - (h))))
1414
15+#define __GENMASK_U128(h, l) \
16+ ((_BIT128((h)) << 1) - (_BIT128(l)))
17+
1518 #endif /* _UAPI_LINUX_BITS_H */
include/uapi/linux/const.h+17−0
@@ -28,6 +28,23 @@ · 27 unmodified lines
2828 #define _BITUL(x) (_UL(1) << (x))
2929 #define _BITULL(x) (_ULL(1) << (x))
3030
31+#if !defined(__ASSEMBLY__)
32+/*
33+ * Missing asm support
34+ *
35+ * __BIT128() would not work in the asm code, as it shifts an
36+ * 'unsigned __init128' data type as direct representation of
37+ * 128 bit constants is not supported in the gcc compiler, as
38+ * they get silently truncated.
39+ *
40+ * TODO: Please revisit this implementation when gcc compiler
41+ * starts representing 128 bit constants directly like long
42+ * and unsigned long etc. Subsequently drop the comment for
43+ * GENMASK_U128() which would then start supporting asm code.
44+ */
45+#define _BIT128(x) ((unsigned __int128)(1) << (x))
46+#endif
47+
3148 #define __ALIGN_KERNEL(x, a) __ALIGN_KERNEL_MASK(x, (__typeof__(x))(a) - 1)
3249 #define __ALIGN_KERNEL_MASK(x, mask) (((x) + (mask)) & ~(mask))
3350
lib/test_bits.c+34−0
@@ -39,6 +39,36 @@ static void genmask_ull_test(struct kunit *test) · 38 unmodified lines
3939 #endif
4040 }
4141
42+static void genmask_u128_test(struct kunit *test)
43+{
44+#ifdef CONFIG_ARCH_SUPPORTS_INT128
45+ /* Below 64 bit masks */
46+ KUNIT_EXPECT_EQ(test, 0x0000000000000001ull, GENMASK_U128(0, 0));
47+ KUNIT_EXPECT_EQ(test, 0x0000000000000003ull, GENMASK_U128(1, 0));
48+ KUNIT_EXPECT_EQ(test, 0x0000000000000006ull, GENMASK_U128(2, 1));
49+ KUNIT_EXPECT_EQ(test, 0x00000000ffffffffull, GENMASK_U128(31, 0));
50+ KUNIT_EXPECT_EQ(test, 0x000000ffffe00000ull, GENMASK_U128(39, 21));
51+ KUNIT_EXPECT_EQ(test, 0xffffffffffffffffull, GENMASK_U128(63, 0));
52+
53+ /* Above 64 bit masks - only 64 bit portion can be validated once */
54+ KUNIT_EXPECT_EQ(test, 0xffffffffffffffffull, GENMASK_U128(64, 0) >> 1);
55+ KUNIT_EXPECT_EQ(test, 0x00000000ffffffffull, GENMASK_U128(81, 50) >> 50);
56+ KUNIT_EXPECT_EQ(test, 0x0000000000ffffffull, GENMASK_U128(87, 64) >> 64);
57+ KUNIT_EXPECT_EQ(test, 0x0000000000ff0000ull, GENMASK_U128(87, 80) >> 64);
58+
59+ KUNIT_EXPECT_EQ(test, 0xffffffffffffffffull, GENMASK_U128(127, 0) >> 64);
60+ KUNIT_EXPECT_EQ(test, 0xffffffffffffffffull, (u64)GENMASK_U128(127, 0));
61+ KUNIT_EXPECT_EQ(test, 0x0000000000000003ull, GENMASK_U128(127, 126) >> 126);
62+ KUNIT_EXPECT_EQ(test, 0x0000000000000001ull, GENMASK_U128(127, 127) >> 127);
63+#ifdef TEST_GENMASK_FAILURES
64+ /* these should fail compilation */
65+ GENMASK_U128(0, 1);
66+ GENMASK_U128(0, 10);
67+ GENMASK_U128(9, 10);
68+#endif /* TEST_GENMASK_FAILURES */
69+#endif /* CONFIG_ARCH_SUPPORTS_INT128 */
70+}
71+
4272 static void genmask_input_check_test(struct kunit *test)
4373 {
4474 unsigned int x, y;
@@ -56,12 +86,16 @@ static void genmask_input_check_test(struct kunit *test) · 11 unmodified lines
5686 /* Valid input */
5787 KUNIT_EXPECT_EQ(test, 0, GENMASK_INPUT_CHECK(1, 1));
5888 KUNIT_EXPECT_EQ(test, 0, GENMASK_INPUT_CHECK(39, 21));
89+ KUNIT_EXPECT_EQ(test, 0, GENMASK_INPUT_CHECK(100, 80));
90+ KUNIT_EXPECT_EQ(test, 0, GENMASK_INPUT_CHECK(110, 65));
91+ KUNIT_EXPECT_EQ(test, 0, GENMASK_INPUT_CHECK(127, 0));
5992 }
6093
6194
6295 static struct kunit_case bits_test_cases[] = {
6396 KUNIT_CASE(genmask_test),
6497 KUNIT_CASE(genmask_ull_test),
98+ KUNIT_CASE(genmask_u128_test),
6599 KUNIT_CASE(genmask_input_check_test),
66100 {}
67101 };