Merge tag 'bitmap-for-6.10v2' of https://github.com/norov/linux
authorLinus Torvalds <torvalds@linux-foundation.org>
Tue, 21 May 2024 22:29:01 +0000 (15:29 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Tue, 21 May 2024 22:29:01 +0000 (15:29 -0700)
Pull bitmap updates from Yury Norov:

 - topology_span_sane() optimization from Kyle Meyer

 - fns() rework from Kuan-Wei Chiu (used in cpumask_local_spread() and
   other places)

 - headers cleanup from Andy

 - add a MAINTAINERS record for bitops API

* tag 'bitmap-for-6.10v2' of https://github.com/norov/linux:
  usercopy: Don't use "proxy" headers
  bitops: Move aligned_byte_mask() to wordpart.h
  MAINTAINERS: add BITOPS API record
  bitmap: relax find_nth_bit() limitation on return value
  lib: make test_bitops compilable into the kernel image
  bitops: Optimize fns() for improved performance
  lib/test_bitops: Add benchmark test for fns()
  Compiler Attributes: Add __always_used macro
  sched/topology: Optimize topology_span_sane()
  cpumask: Add for_each_cpu_from()

1  2 
MAINTAINERS
include/linux/bitops.h
include/linux/cpumask.h
include/linux/find.h
kernel/sched/topology.c
lib/Kconfig.debug
lib/find_bit.c
lib/test_bitmap.c

diff --cc MAINTAINERS
Simple merge
index 3112ae7d6524b79d4ae2e5890107bbef1e89ba1c,3313d2c04e6d9f57b4acbd5fb68e52e87155aa0c..46d4bdc634c0bbaa7da315529d43937abaf205c2
@@@ -255,18 -245,12 +248,12 @@@ static inline unsigned int __ffs64(u64 
   * @word: The word to search
   * @n: Bit to find
   */
 -static inline unsigned long fns(unsigned long word, unsigned int n)
 +static inline unsigned int fns(unsigned long word, unsigned int n)
  {
-       unsigned int bit;
-       while (word) {
-               bit = __ffs(word);
-               if (n-- == 0)
-                       return bit;
-               __clear_bit(bit, &word);
-       }
+       while (word && n--)
+               word &= word - 1;
  
-       return BITS_PER_LONG;
+       return word ? __ffs(word) : BITS_PER_LONG;
  }
  
  /**
Simple merge
Simple merge
Simple merge
Simple merge
diff --cc lib/find_bit.c
Simple merge
Simple merge