[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ef7931be-1f18-44c2-aba3-36c3f0aae388@efficios.com>
Date: Mon, 10 Nov 2025 11:42:05 -0500
From: Mathieu Desnoyers <mathieu.desnoyers@...icios.com>
To: Peter Zijlstra <peterz@...radead.org>,
Thomas Gleixner <tglx@...utronix.de>
Cc: Shrikanth Hegde <sshegde@...ux.ibm.com>,
Gabriele Monaco <gmonaco@...hat.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 2025-11-10 11:11, Peter Zijlstra wrote:
> On Mon, Nov 03, 2025 at 02:29:59PM +0100, Thomas Gleixner wrote:
>> On Mon, Nov 03 2025 at 14:45, Shrikanth Hegde wrote:
>>> On 10/29/25 6:39 PM, Thomas Gleixner wrote:
>>>> +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 ?
>>
>> No. cpumask_weight_and() does weight(mask1 & mask2) but this does
>
> The comment was about naming, notable: s/_weighted_or/_weight_or/g to
> better match the existing _weight_and().
But if we go for "_weight_or" to match "_weight_and", we end up with
the following different semantics between "or" and "and":
cpumask_weight_and():
inputs: mask1, mask2
outputs: none
return weight(mask1 & mask2);
cpumask_weight_or():
inputs: mask1, mask2
outputs: mask3
mask3 = mask1 | mask2;
return weight(mask3);
What we are trying to do here is apply a bitwise operation on two
inputs, write the resulting mask into mask3, *and* calculate the weight
as well, which is different from just calculating the weight.
Naming things is hard. I agree that the distinction between "weight" and
"weighted" is subtle.
Perhaps something along the lines of cpumask_eval_weight_or()
which would state the two operations performed (evaluate and calculate
the weight) could work ?
Thanks,
Mathieu
--
Mathieu Desnoyers
EfficiOS Inc.
https://www.efficios.com
Powered by blists - more mailing lists