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] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAKfTPtCHhWGfR7ew0vf=3c2euWaHjTMZpAmwiYcq5eMEmauKAg@mail.gmail.com>
Date: Thu, 11 Sep 2025 10:50:28 +0200
From: Vincent Guittot <vincent.guittot@...aro.org>
To: Yury Norov <yury.norov@...il.com>
Cc: Ingo Molnar <mingo@...hat.com>, Peter Zijlstra <peterz@...radead.org>, 
	Juri Lelli <juri.lelli@...hat.com>, 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
Subject: Re: [PATCH] sched/fair: use cpumask_weight_and() in sched_balance_find_dst_group()

On Thu, 11 Sept 2025 at 05:44, Yury Norov <yury.norov@...il.com> wrote:
>
> From: Yury Norov (NVIDIA) <yury.norov@...il.com>
>
> 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.
>
> Signed-off-by: Yury Norov (NVIDIA) <yury.norov@...il.com>

Reviewed-by: Vincent Guittot <vincent.guittot@...aro.org>

> ---
>  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 7229339cbb1b..4ec012912cd1 100644
> --- a/kernel/sched/fair.c
> +++ b/kernel/sched/fair.c
> @@ -10821,10 +10821,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 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