Subject: linux-next: manual merge of the mm tree with the bitmap tree

From: Stephen Rothwell <[email-masked]>
Date: Mon, 4 Jul 2022 16:58:41 +1000

Hi all,

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

  include/linux/cpumask.h

between commits:

  50e413c31800 ("lib/cpumask: change return types to unsigned")
  e32bd0390739 ("lib/cpumask: move one-line wrappers around find_bit to the header")

from the bitmap tree and commits:

  2b0b9f2665b2 ("cpumask: Fix invalid uniprocessor mask assumption")
  284d22458843 ("cpumask: update cpumask_next_wrap() signature")

from the mm tree.

I fixed it up (I hope, 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 0738a6c9be40,523857884ae4..000000000000
--- a/include/linux/cpumask.h
+++ b/include/linux/cpumask.h
@@@ -274,29 -179,31 +195,47 @@@ static inline unsigned int cpumask_next
  	return find_next_zero_bit(cpumask_bits(srcp), nr_cpumask_bits, n+1);
  }
  
 -int __pure cpumask_next_and(int n, const struct cpumask *, const struct cpumask *);
 -int __pure cpumask_any_but(const struct cpumask *mask, unsigned int cpu);
 +/**
 + * cpumask_next_and - get the next cpu in *src1p & *src2p
 + * @n: the cpu prior to the place to search (ie. return will be > @n)
 + * @src1p: the first cpumask pointer
 + * @src2p: the second cpumask pointer
 + *
 + * Returns >= nr_cpu_ids if no further cpus set in both.
 + */
 +static inline
 +unsigned int cpumask_next_and(int n, const struct cpumask *src1p,
 +		     const struct cpumask *src2p)
 +{
 +	/* -1 is a legal arg here. */
 +	if (n != -1)
 +		cpumask_check(n);
 +	return find_next_and_bit(cpumask_bits(src1p), cpumask_bits(src2p),
 +		nr_cpumask_bits, n + 1);
 +}
  
+ #if NR_CPUS == 1
+ /* Uniprocessor: there is only one valid CPU */
+ static inline unsigned int cpumask_local_spread(unsigned int i, int node)
+ {
+ 	return 0;
+ }
+ 
+ static inline int cpumask_any_and_distribute(const struct cpumask *src1p,
+ 					     const struct cpumask *src2p) {
+ 	return cpumask_first_and(src1p, src2p);
+ }
+ 
+ static inline int cpumask_any_distribute(const struct cpumask *srcp)
+ {
+ 	return cpumask_first(srcp);
+ }
+ #else
  unsigned int cpumask_local_spread(unsigned int i, int node);
 -int cpumask_any_and_distribute(const struct cpumask *src1p,
 +unsigned int cpumask_any_and_distribute(const struct cpumask *src1p,
  			       const struct cpumask *src2p);
 -int cpumask_any_distribute(const struct cpumask *srcp);
 +unsigned int cpumask_any_distribute(const struct cpumask *srcp);
+ #endif /* NR_CPUS */
  
  /**
   * for_each_cpu - iterate over every cpu in a mask
@@@ -322,7 -229,7 +261,7 @@@
  		(cpu) = cpumask_next_zero((cpu), (mask)),	\
  		(cpu) < nr_cpu_ids;)
  
- unsigned int cpumask_next_wrap(int n, const struct cpumask *mask, int start, bool wrap);
 -int __pure cpumask_next_wrap(int n, const struct cpumask *mask, int start, bool wrap);
++unsigned int __pure cpumask_next_wrap(int n, const struct cpumask *mask, int start, bool wrap);
  
  /**
   * for_each_cpu_wrap - iterate over every cpu in a mask, starting at a specified location