Re: [PATCH 1/4] cpumask: relax cpumask_any_but()

Yury Norov
2025-04-24T02:46:11Z

On Wed, Apr 23, 2025 at 02:28:03PM -0700, Reinette Chatre wrote:
> Hi Yury,
>
> On 4/7/25 8:38 AM, Yury Norov wrote:
> > From: Yury Norov [NVIDIA] <yury.norov@gmail.com>
> >
> > Similarly to other cpumask search functions, accept -1, and consider
> > it as 'any cpu' hint. This helps users to avoid coding special cases.
> >
> > Signed-off-by: Yury Norov [NVIDIA] <yury.norov@gmail.com>
> > ---
> > include/linux/cpumask.h | 12 ++++++++++--
> > 1 file changed, 10 insertions(+), 2 deletions(-)
> >
> > diff --git a/include/linux/cpumask.h b/include/linux/cpumask.h
> > index beff4d26e605..0f816092c891 100644
> > --- a/include/linux/cpumask.h
> > +++ b/include/linux/cpumask.h
> > @@ -413,6 +413,7 @@ unsigned int cpumask_next_wrap(int n, const struct cpumask *src)
> > * @cpu: the cpu to ignore.
> > *
> > * Often used to find any cpu but smp_processor_id() in a mask.
> > + * If @cpu == -1, the function is equivalent to cpumask_any().
>
> Now that -1 is a legal argument, should the "cpu" parameter be of "int" type (instead of
> "unsigned int")?

Yes, you're right. Need to fix this.