linux-next: manual merge of the bitmap tree with Linus' tree

From: Stephen Rothwell
Date: Mon Mar 06 2023 - 19:27:27 EST


Hi all,

Today's linux-next merge of the bitmap tree got a conflict in:

include/linux/cpumask.h

between commit:

596ff4a09b89 ("cpumask: re-introduce constant-sized cpumask optimizations")

from Linus' tree and commit:

1507ca9f866c ("bitmap: switch from inline to __always_inline")

from the bitmap tree.

I fixed it up (see below) and can carry the fix as necessary. This
is now fixed as far as linux-next is concerned, but any non trivial
conflicts should be mentioned to your upstream maintainer when your tree
is submitted for merging. You may also want to consider cooperating
with the maintainer of the conflicting tree to minimise any particularly
complex conflicts.

--
Cheers,
Stephen Rothwell

diff --cc include/linux/cpumask.h
index ce8eb7ef2107,fcb35ea34090..000000000000
--- a/include/linux/cpumask.h
+++ b/include/linux/cpumask.h
@@@ -157,9 -124,9 +157,9 @@@ static __always_inline unsigned int cpu
*
* Returns >= nr_cpu_ids if no cpus set.
*/
- static inline unsigned int cpumask_first(const struct cpumask *srcp)
+ static __always_inline unsigned int cpumask_first(const struct cpumask *srcp)
{
- return find_first_bit(cpumask_bits(srcp), nr_cpumask_bits);
+ return find_first_bit(cpumask_bits(srcp), small_cpumask_bits);
}

/**
@@@ -168,9 -135,9 +168,9 @@@
*
* Returns >= nr_cpu_ids if all cpus are set.
*/
- static inline unsigned int cpumask_first_zero(const struct cpumask *srcp)
+ static __always_inline unsigned int cpumask_first_zero(const struct cpumask *srcp)
{
- return find_first_zero_bit(cpumask_bits(srcp), nr_cpumask_bits);
+ return find_first_zero_bit(cpumask_bits(srcp), small_cpumask_bits);
}

/**
@@@ -180,10 -147,10 +180,10 @@@
*
* Returns >= nr_cpu_ids if no cpus set in both. See also cpumask_next_and().
*/
- static inline
+ static __always_inline
unsigned int cpumask_first_and(const struct cpumask *srcp1, const struct cpumask *srcp2)
{
- return find_first_and_bit(cpumask_bits(srcp1), cpumask_bits(srcp2), nr_cpumask_bits);
+ return find_first_and_bit(cpumask_bits(srcp1), cpumask_bits(srcp2), small_cpumask_bits);
}

/**
@@@ -192,9 -159,9 +192,9 @@@
*
* Returns >= nr_cpumask_bits if no CPUs set.
*/
- static inline unsigned int cpumask_last(const struct cpumask *srcp)
+ static __always_inline unsigned int cpumask_last(const struct cpumask *srcp)
{
- return find_last_bit(cpumask_bits(srcp), nr_cpumask_bits);
+ return find_last_bit(cpumask_bits(srcp), small_cpumask_bits);
}

/**
@@@ -279,10 -246,20 +279,10 @@@ unsigned int cpumask_next_and(int n, co
* After the loop, cpu is >= nr_cpu_ids.
*/
#define for_each_cpu(cpu, mask) \
- for_each_set_bit(cpu, cpumask_bits(mask), nr_cpumask_bits)
-
-/**
- * for_each_cpu_not - iterate over every cpu in a complemented mask
- * @cpu: the (optionally unsigned) integer iterator
- * @mask: the cpumask pointer
- *
- * After the loop, cpu is >= nr_cpu_ids.
- */
-#define for_each_cpu_not(cpu, mask) \
- for_each_clear_bit(cpu, cpumask_bits(mask), nr_cpumask_bits)
+ for_each_set_bit(cpu, cpumask_bits(mask), small_cpumask_bits)

#if NR_CPUS == 1
- static inline
+ static __always_inline
unsigned int cpumask_next_wrap(int n, const struct cpumask *mask, int start, bool wrap)
{
cpumask_check(start);
@@@ -377,9 -354,9 +377,9 @@@ unsigned int cpumask_any_but(const stru
*
* Returns >= nr_cpu_ids if such cpu doesn't exist.
*/
- static inline unsigned int cpumask_nth(unsigned int cpu, const struct cpumask *srcp)
+ static __always_inline unsigned int cpumask_nth(unsigned int cpu, const struct cpumask *srcp)
{
- return find_nth_bit(cpumask_bits(srcp), nr_cpumask_bits, cpumask_check(cpu));
+ return find_nth_bit(cpumask_bits(srcp), small_cpumask_bits, cpumask_check(cpu));
}

/**
@@@ -518,23 -495,19 +518,23 @@@ static __always_inline bool cpumask_tes
/**
* cpumask_setall - set all cpus (< nr_cpu_ids) in a cpumask
* @dstp: the cpumask pointer
+ *
+ * Note: since we set bits, we should use the tighter 'bitmap_set()' with
+ * the eact number of bits, not 'bitmap_fill()' that will fill past the
+ * end.
*/
- static inline void cpumask_setall(struct cpumask *dstp)
+ static __always_inline void cpumask_setall(struct cpumask *dstp)
{
- bitmap_fill(cpumask_bits(dstp), nr_cpumask_bits);
+ bitmap_set(cpumask_bits(dstp), 0, nr_cpumask_bits);
}

/**
* cpumask_clear - clear all cpus (< nr_cpu_ids) in a cpumask
* @dstp: the cpumask pointer
*/
- static inline void cpumask_clear(struct cpumask *dstp)
+ static __always_inline void cpumask_clear(struct cpumask *dstp)
{
- bitmap_zero(cpumask_bits(dstp), nr_cpumask_bits);
+ bitmap_zero(cpumask_bits(dstp), large_cpumask_bits);
}

/**
@@@ -652,9 -637,9 +652,9 @@@ static __always_inline bool cpumask_sub
* cpumask_empty - *srcp == 0
* @srcp: the cpumask to that all cpus < nr_cpu_ids are clear.
*/
- static inline bool cpumask_empty(const struct cpumask *srcp)
+ static __always_inline bool cpumask_empty(const struct cpumask *srcp)
{
- return bitmap_empty(cpumask_bits(srcp), nr_cpumask_bits);
+ return bitmap_empty(cpumask_bits(srcp), small_cpumask_bits);
}

/**
@@@ -670,9 -655,9 +670,9 @@@ static __always_inline bool cpumask_ful
* cpumask_weight - Count of bits in *srcp
* @srcp: the cpumask to count bits (< nr_cpu_ids) in.
*/
- static inline unsigned int cpumask_weight(const struct cpumask *srcp)
+ static __always_inline unsigned int cpumask_weight(const struct cpumask *srcp)
{
- return bitmap_weight(cpumask_bits(srcp), nr_cpumask_bits);
+ return bitmap_weight(cpumask_bits(srcp), small_cpumask_bits);
}

/**
@@@ -680,10 -665,10 +680,10 @@@
* @srcp1: the cpumask to count bits (< nr_cpu_ids) in.
* @srcp2: the cpumask to count bits (< nr_cpu_ids) in.
*/
- static inline unsigned int cpumask_weight_and(const struct cpumask *srcp1,
+ static __always_inline unsigned int cpumask_weight_and(const struct cpumask *srcp1,
const struct cpumask *srcp2)
{
- return bitmap_weight_and(cpumask_bits(srcp1), cpumask_bits(srcp2), nr_cpumask_bits);
+ return bitmap_weight_and(cpumask_bits(srcp1), cpumask_bits(srcp2), small_cpumask_bits);
}

/**
@@@ -717,10 -702,10 +717,10 @@@ static __always_inline void cpumask_shi
* @dstp: the result
* @srcp: the input cpumask
*/
- static inline void cpumask_copy(struct cpumask *dstp,
+ static __always_inline void cpumask_copy(struct cpumask *dstp,
const struct cpumask *srcp)
{
- bitmap_copy(cpumask_bits(dstp), cpumask_bits(srcp), nr_cpumask_bits);
+ bitmap_copy(cpumask_bits(dstp), cpumask_bits(srcp), large_cpumask_bits);
}

/**
@@@ -802,9 -787,9 +802,9 @@@ static __always_inline int cpulist_pars
/**
* cpumask_size - size to allocate for a 'struct cpumask' in bytes
*/
- static inline unsigned int cpumask_size(void)
+ static __always_inline unsigned int cpumask_size(void)
{
- return BITS_TO_LONGS(nr_cpumask_bits) * sizeof(long);
+ return BITS_TO_LONGS(large_cpumask_bits) * sizeof(long);
}

/*

Attachment: pgpTpvRwRpkmY.pgp
Description: OpenPGP digital signature