lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <aR3uT3LRxvXe4XWT@yury>
Date: Wed, 19 Nov 2025 11:20:31 -0500
From: Yury Norov <yury.norov@...il.com>
To: Thomas Gleixner <tglx@...utronix.de>
Cc: LKML <linux-kernel@...r.kernel.org>,
	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>,
	Shrikanth Hegde <sshegde@...ux.ibm.com>
Subject: Re: [patch V4 08/20] sched/mmcid: Use cpumask_weighted_or()

On Sun, Nov 16, 2025 at 09:48:49PM +0100, Thomas Gleixner wrote:
> Use cpumask_weighted_or() instead of cpumask_or() and cpumask_weight() on
> the result, which walks the same bitmap twice. Results in 10-20% less
> cycles, which reduces the runqueue lock hold time.
> 
> Signed-off-by: Thomas Gleixner <tglx@...utronix.de>
> Reviewed-by: Mathieu Desnoyers <mathieu.desnoyers@...icios.com>

Acked-by: Yury Norov (NVIDIA) <yury.norov@...il.com>

> ---
>  kernel/sched/core.c |    5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> --- a/kernel/sched/core.c
> +++ b/kernel/sched/core.c
> @@ -10377,6 +10377,7 @@ void call_trace_sched_update_nr_running(
>  static inline void mm_update_cpus_allowed(struct mm_struct *mm, const struct cpumask *affmsk)
>  {
>  	struct cpumask *mm_allowed;
> +	unsigned int weight;
>  
>  	if (!mm)
>  		return;
> @@ -10387,8 +10388,8 @@ static inline void mm_update_cpus_allowe
>  	 */
>  	guard(raw_spinlock)(&mm->mm_cid.lock);
>  	mm_allowed = mm_cpus_allowed(mm);
> -	cpumask_or(mm_allowed, mm_allowed, affmsk);
> -	WRITE_ONCE(mm->mm_cid.nr_cpus_allowed, cpumask_weight(mm_allowed));
> +	weight = cpumask_weighted_or(mm_allowed, mm_allowed, affmsk);
> +	WRITE_ONCE(mm->mm_cid.nr_cpus_allowed, weight);
>  }
>  
>  void sched_mm_cid_exit_signals(struct task_struct *t)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ