Pull bitmap updates from Yury Norov: - fix the duplicated comments on bitmap_to_arr64() (Qu Wenruo) - optimize out non-atomic bitops on compile-time constants (Alexander Lobakin) - cleanup bitmap-related headers (Yury Norov) - x86/olpc: fix 'logical not is only applied to the left hand side' (Alexander Lobakin) - lib/nodemask: inline wrappers around bitmap (Yury Norov) * tag 'bitmap-6.0-rc1' of https://github.com/norov/linux: (26 commits) lib/nodemask: inline next_node_in() and node_random() powerpc: drop dependency on <asm/machdep.h> in archrandom.h x86/olpc: fix 'logical not is only applied to the left hand side' lib/cpumask: move some one-line wrappers to header file headers/deps: mm: align MANITAINERS and Docs with new gfp.h structure headers/deps: mm: Split <linux/gfp_types.h> out of <linux/gfp.h> headers/deps: mm: Optimize <linux/gfp.h> header dependencies lib/cpumask: move trivial wrappers around find_bit to the header lib/cpumask: change return types to unsigned where appropriate cpumask: change return types to bool where appropriate lib/bitmap: change type of bitmap_weight to unsigned long lib/bitmap: change return types to bool where appropriate arm: align find_bit declarations with generic kernel iommu/vt-d: avoid invalid memory access via node_online(NUMA_NO_NODE) lib/test_bitmap: test the tail after bitmap_to_arr64() lib/bitmap: fix off-by-one in bitmap_to_arr64() lib: test_bitmap: add compile-time optimization/evaluations assertions bitmap: don't assume compiler evaluates small mem*() builtins calls net/ice: fix initializing the bitmap in the switch code bitops: let optimize out non-atomic bitops on compile-time constants ...
Showing the changes to tools/include/linux (2 of 38 files). Show all
Unified · Split
| @@ -11,10 +11,10 @@ · 10 unmodified lines | |||
| 11 | #define DECLARE_BITMAP(name,bits) \ | 11 | #define DECLARE_BITMAP(name,bits) \ |
| 12 | unsigned long name[BITS_TO_LONGS(bits)] | 12 | unsigned long name[BITS_TO_LONGS(bits)] |
| 13 | 13 | ||
| 14 | int __bitmap_weight(const unsigned long *bitmap, int bits); | 14 | unsigned int __bitmap_weight(const unsigned long *bitmap, int bits); |
| 15 | void __bitmap_or(unsigned long *dst, const unsigned long *bitmap1, | 15 | void __bitmap_or(unsigned long *dst, const unsigned long *bitmap1, |
| 16 | const unsigned long *bitmap2, int bits); | 16 | const unsigned long *bitmap2, int bits); |
| 17 | int __bitmap_and(unsigned long *dst, const unsigned long *bitmap1, | 17 | bool __bitmap_and(unsigned long *dst, const unsigned long *bitmap1, |
| 18 | const unsigned long *bitmap2, unsigned int bits); | 18 | const unsigned long *bitmap2, unsigned int bits); |
| 19 | bool __bitmap_equal(const unsigned long *bitmap1, | 19 | bool __bitmap_equal(const unsigned long *bitmap1, |
| 20 | const unsigned long *bitmap2, unsigned int bits); | 20 | const unsigned long *bitmap2, unsigned int bits); |
| @@ -45,7 +45,7 @@ static inline void bitmap_fill(unsigned long *dst, unsigned int nbits) · 24 unmodified lines | |||
| 45 | dst[nlongs - 1] = BITMAP_LAST_WORD_MASK(nbits); | 45 | dst[nlongs - 1] = BITMAP_LAST_WORD_MASK(nbits); |
| 46 | } | 46 | } |
| 47 | 47 | ||
| 48 | static inline int bitmap_empty(const unsigned long *src, unsigned nbits) | 48 | static inline bool bitmap_empty(const unsigned long *src, unsigned int nbits) |
| 49 | { | 49 | { |
| 50 | if (small_const_nbits(nbits)) | 50 | if (small_const_nbits(nbits)) |
| 51 | return ! (*src & BITMAP_LAST_WORD_MASK(nbits)); | 51 | return ! (*src & BITMAP_LAST_WORD_MASK(nbits)); |
| @@ -53,7 +53,7 @@ static inline int bitmap_empty(const unsigned long *src, unsigned nbits) · 1 unmodified line | |||
| 53 | return find_first_bit(src, nbits) == nbits; | 53 | return find_first_bit(src, nbits) == nbits; |
| 54 | } | 54 | } |
| 55 | 55 | ||
| 56 | static inline int bitmap_full(const unsigned long *src, unsigned int nbits) | 56 | static inline bool bitmap_full(const unsigned long *src, unsigned int nbits) |
| 57 | { | 57 | { |
| 58 | if (small_const_nbits(nbits)) | 58 | if (small_const_nbits(nbits)) |
| 59 | return ! (~(*src) & BITMAP_LAST_WORD_MASK(nbits)); | 59 | return ! (~(*src) & BITMAP_LAST_WORD_MASK(nbits)); |
| @@ -61,7 +61,7 @@ static inline int bitmap_full(const unsigned long *src, unsigned int nbits) · 1 unmodified line | |||
| 61 | return find_first_zero_bit(src, nbits) == nbits; | 61 | return find_first_zero_bit(src, nbits) == nbits; |
| 62 | } | 62 | } |
| 63 | 63 | ||
| 64 | static inline int bitmap_weight(const unsigned long *src, unsigned int nbits) | 64 | static inline unsigned int bitmap_weight(const unsigned long *src, unsigned int nbits) |
| 65 | { | 65 | { |
| 66 | if (small_const_nbits(nbits)) | 66 | if (small_const_nbits(nbits)) |
| 67 | return hweight_long(*src & BITMAP_LAST_WORD_MASK(nbits)); | 67 | return hweight_long(*src & BITMAP_LAST_WORD_MASK(nbits)); |
| @@ -146,7 +146,7 @@ size_t bitmap_scnprintf(unsigned long *bitmap, unsigned int nbits, · 78 unmodified lines | |||
| 146 | * @src2: operand 2 | 146 | * @src2: operand 2 |
| 147 | * @nbits: size of bitmap | 147 | * @nbits: size of bitmap |
| 148 | */ | 148 | */ |
| 149 | static inline int bitmap_and(unsigned long *dst, const unsigned long *src1, | 149 | static inline bool bitmap_and(unsigned long *dst, const unsigned long *src1, |
| 150 | const unsigned long *src2, unsigned int nbits) | 150 | const unsigned long *src2, unsigned int nbits) |
| 151 | { | 151 | { |
| 152 | if (small_const_nbits(nbits)) | 152 | if (small_const_nbits(nbits)) |
| @@ -25,6 +25,22 @@ extern unsigned int __sw_hweight16(unsigned int w); · 24 unmodified lines | |||
| 25 | extern unsigned int __sw_hweight32(unsigned int w); | 25 | extern unsigned int __sw_hweight32(unsigned int w); |
| 26 | extern unsigned long __sw_hweight64(__u64 w); | 26 | extern unsigned long __sw_hweight64(__u64 w); |
| 27 | 27 | ||
| 28 | /* | ||
| 29 | * Defined here because those may be needed by architecture-specific static | ||
| 30 | * inlines. | ||
| 31 | */ | ||
| 32 | |||
| 33 | #define bitop(op, nr, addr) \ | ||
| 34 | op(nr, addr) | ||
| 35 | |||
| 36 | #define __set_bit(nr, addr) bitop(___set_bit, nr, addr) | ||
| 37 | #define __clear_bit(nr, addr) bitop(___clear_bit, nr, addr) | ||
| 38 | #define __change_bit(nr, addr) bitop(___change_bit, nr, addr) | ||
| 39 | #define __test_and_set_bit(nr, addr) bitop(___test_and_set_bit, nr, addr) | ||
| 40 | #define __test_and_clear_bit(nr, addr) bitop(___test_and_clear_bit, nr, addr) | ||
| 41 | #define __test_and_change_bit(nr, addr) bitop(___test_and_change_bit, nr, addr) | ||
| 42 | #define test_bit(nr, addr) bitop(_test_bit, nr, addr) | ||
| 43 | |||
| 28 | /* | 44 | /* |
| 29 | * Include this here because some architectures need generic_ffs/fls in | 45 | * Include this here because some architectures need generic_ffs/fls in |
| 30 | * scope | 46 | * scope |