From: K Prateek Nayak <kprateek.nayak@amd.com>
To: Yury Norov <yury.norov@gmail.com>, Ingo Molnar <mingo@redhat.com>,
"Peter Zijlstra" <peterz@infradead.org>,
Juri Lelli <juri.lelli@redhat.com>,
"Vincent Guittot" <vincent.guittot@linaro.org>,
Dietmar Eggemann <dietmar.eggemann@arm.com>,
Steven Rostedt <rostedt@goodmis.org>,
Ben Segall <bsegall@google.com>, Mel Gorman <mgorman@suse.de>,
Valentin Schneider <vschneid@redhat.com>,
<linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] sched/fair: use cpumask_weight_and() in sched_balance_find_dst_group()
Date: Thu, 11 Sep 2025 12:22:23 +0530 [thread overview]
Message-ID: <1198e424-cd1d-407d-8050-c561e57dd2b3@amd.com> (raw)
In-Reply-To: <20250911034454.494852-1-yury.norov@gmail.com>
Hello Yury,
On 9/11/2025 9:14 AM, Yury Norov wrote:
> From: Yury Norov (NVIDIA) <yury.norov@gmail.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.
Neat! I didn't realize this existed back when I added that cpumask_and()
+ cpumask_weight() combo. Please feel free to include:
Reviewed-by: K Prateek Nayak <kprateek.nayak@amd.com>
>
> Signed-off-by: Yury Norov (NVIDIA) <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 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);
--
Thanks and Regards,
Prateek
next prev parent reply other threads:[~2025-09-11 6:52 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-09-11 3:44 [PATCH] sched/fair: use cpumask_weight_and() in sched_balance_find_dst_group() Yury Norov
2025-09-11 6:52 ` K Prateek Nayak [this message]
2025-09-11 8:50 ` Vincent Guittot
2025-09-11 8:58 ` Fernand Sieber
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1198e424-cd1d-407d-8050-c561e57dd2b3@amd.com \
--to=kprateek.nayak@amd.com \
--cc=bsegall@google.com \
--cc=dietmar.eggemann@arm.com \
--cc=juri.lelli@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mgorman@suse.de \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
--cc=rostedt@goodmis.org \
--cc=vincent.guittot@linaro.org \
--cc=vschneid@redhat.com \
--cc=yury.norov@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox