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

Stephen Rothwell posted 1 patch 3 years, 9 months ago
There is a newer version of this series
linux-next: manual merge of the mm tree with the bitmap tree
Posted by Stephen Rothwell 3 years, 9 months ago
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
Re: linux-next: manual merge of the mm tree with the bitmap tree
Posted by Stephen Rothwell 3 years, 9 months ago
Hi all,

On Mon, 4 Jul 2022 16:58:41 +1000 Stephen Rothwell <sfr@canb.auug.org.au> wrote:
>
> 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

It actually needed to be:

785d45d2ce79973aa13920e855aff8a67c61b1c8
diff --cc include/linux/cpumask.h
index 0738a6c9be40,523857884ae4..6a8f75cc9985
--- 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
@@@ -358,27 -265,6 +297,26 @@@
  		(cpu) = cpumask_next_and((cpu), (mask1), (mask2)),	\
  		(cpu) < nr_cpu_ids;)
  
 +/**
 + * cpumask_any_but - return a "random" in a cpumask, but not this one.
 + * @mask: the cpumask to search
 + * @cpu: the cpu to ignore.
 + *
 + * Often used to find any cpu but smp_processor_id() in a mask.
 + * Returns >= nr_cpu_ids if no cpus set.
 + */
 +static inline
 +unsigned int cpumask_any_but(const struct cpumask *mask, unsigned int cpu)
 +{
 +	unsigned int i;
 +
 +	cpumask_check(cpu);
 +	for_each_cpu(i, mask)
 +		if (i != cpu)
 +			break;
 +	return i;
 +}
- #endif /* SMP */
 +
  #define CPU_BITS_NONE						\
  {								\
  	[0 ... BITS_TO_LONGS(NR_CPUS)-1] = 0UL			\
Re: linux-next: manual merge of the mm tree with the bitmap tree
Posted by Sander Vanheule 3 years, 9 months ago
Hi Stephen,

On Mon, 2022-07-04 at 17:26 +1000, Stephen Rothwell wrote:
> Hi all,
> 
> On Mon, 4 Jul 2022 16:58:41 +1000 Stephen Rothwell <sfr@canb.auug.org.au>
> wrote:
> > 
> > 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.
> 

Thanks for solving the conflicts, looks fine to me. I've asked Andrew to reorder
my patches. The end result for the series should be the same though, and I don't
think my patches should require too many changes anymore.

If further merge conflicts arise with Yury's cpumask patches, I'm also fine with
them being run as one series if that would make things easier.

Best,
Sander