[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <88d397b7-5eeb-41eb-ba44-980e72008fd2@linux.ibm.com>
Date: Mon, 3 Nov 2025 14:45:33 +0530
From: Shrikanth Hegde <sshegde@...ux.ibm.com>
To: Thomas Gleixner <tglx@...utronix.de>
Cc: Peter Zijlstra <peterz@...radead.org>,
        Gabriele Monaco <gmonaco@...hat.com>,
        Mathieu Desnoyers <mathieu.desnoyers@...icios.com>,
        Michael Jeanson <mjeanson@...icios.com>, Jens Axboe <axboe@...nel.dk>,
        "Paul E. McKenney" <paulmck@...nel.org>,
        "Gautham R. Shenoy" <gautham.shenoy@....com>,
        Florian Weimer <fweimer@...hat.com>, Tim Chen <tim.c.chen@...el.com>,
        Yury Norov <yury.norov@...il.com>, LKML <linux-kernel@...r.kernel.org>
Subject: Re: [patch V3 07/20] cpumask: Introduce cpumask_weighted_or()
On 10/29/25 6:39 PM, Thomas Gleixner wrote:
> CID management OR's two cpumasks and then calculates the weight on the
> result. That's inefficient as that has to walk the same stuff twice. As
> this is done with runqueue lock held, there is a real benefit of speeding
> this up. Depending on the system this results in 10-20% less cycles spent
> with runqueue lock held for a 4K cpumask.
> 
> Provide cpumask_weighted_or() and the corresponding bitmap functions which
> return the weight of the OR result right away.
> 
> Signed-off-by: Thomas Gleixner <tglx@...utronix.de>
> Reviewed-by: Yury Norov (NVIDIA) <yury.norov@...il.com>
> ---
> V3: Rename again - Yury
> V2: Rename and use the BITMAP_WEIGHT() macro - Yury
> ---
>   include/linux/bitmap.h  |   15 +++++++++++++++
>   include/linux/cpumask.h |   16 ++++++++++++++++
>   lib/bitmap.c            |    6 ++++++
>   3 files changed, 37 insertions(+)
> 
   
>   /**
> + * cpumask_weighted_or - *dstp = *src1p | *src2p and return the weight of the result
> + * @dstp: the cpumask result
> + * @src1p: the first input
> + * @src2p: the second input
> + *
> + * Return: The number of bits set in the resulting cpumask @dstp
> + */
> +static __always_inline
> +unsigned int cpumask_weighted_or(struct cpumask *dstp, const struct cpumask *src1p,
> +				 const struct cpumask *src2p)
> +{
> +	return bitmap_weighted_or(cpumask_bits(dstp), cpumask_bits(src1p),
> +				  cpumask_bits(src2p), small_cpumask_bits);
> +}
nit:
We have currently cpumask_weight_and & variants.
Wouldn't it be better to name it cpumask_weight_or ?
Powered by blists - more mailing lists