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>] [day] [month] [year] [list]
Message-ID: <20251207034247.402926-1-yury.norov@gmail.com>
Date: Sat,  6 Dec 2025 22:42:47 -0500
From: "Yury Norov (NVIDIA)" <yury.norov@...il.com>
To: Peter Zijlstra <peterz@...radead.org>,
	Ingo Molnar <mingo@...hat.com>,
	Juri Lelli <juri.lelli@...hat.com>,
	Vincent Guittot <vincent.guittot@...aro.org>,
	Dietmar Eggemann <dietmar.eggemann@....com>,
	Steven Rostedt <rostedt@...dmis.org>,
	Ben Segall <bsegall@...gle.com>,
	Mel Gorman <mgorman@...e.de>,
	Valentin Schneider <vschneid@...hat.com>,
	linux-kernel@...r.kernel.org
Cc: "Yury Norov (NVIDIA)" <yury.norov@...il.com>,
	K Prateek Nayak <kprateek.nayak@....com>,
	Fernand Sieber <sieberf@...zon.com>
Subject: [PATCH RESEND] sched/fair: use cpumask_weight_and() in sched_balance_find_dst_group()

In the group_has_spare case, the function creates a temporary cpumask
to just calculate weight of (p->cpus_ptr & sched_group_span(local)).

We've got a dedicated helper for it.

Reviewed-by: Vincent Guittot <vincent.guittot@...aro.org>
Reviewed-by: K Prateek Nayak <kprateek.nayak@....com>
Reviewed-by: Fernand Sieber <sieberf@...zon.com>
Signed-off-by: Yury Norov (NVIDIA) <yury.norov@...il.com>
---
Rebased and re-tested on top of master. Original patch:
https://lore.kernel.org/all/20250911034454.494852-1-yury.norov@gmail.com/

 kernel/sched/fair.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index 3ead55e4b8a5..e04f94233cda 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -10972,10 +10972,9 @@ sched_balance_find_dst_group(struct sched_domain *sd, struct task_struct *p, int
 			 * take care of it.
 			 */
 			if (p->nr_cpus_allowed != NR_CPUS) {
-				struct cpumask *cpus = this_cpu_cpumask_var_ptr(select_rq_mask);
-
-				cpumask_and(cpus, sched_group_span(local), p->cpus_ptr);
-				imb_numa_nr = min(cpumask_weight(cpus), sd->imb_numa_nr);
+				unsigned int w = cpumask_weight_and(p->cpus_ptr,
+								sched_group_span(local));
+				imb_numa_nr = min(w, sd->imb_numa_nr);
 			}
 
 			imbalance = abs(local_sgs.idle_cpus - idlest_sgs.idle_cpus);
-- 
2.43.0


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ