From: Madadi Vineeth Reddy <vineethr@linux.ibm.com>
To: Yury Norov <yury.norov@gmail.com>
Cc: 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,
Madadi Vineeth Reddy <vineethr@linux.ibm.com>
Subject: Re: [PATCH] sched: fair: drop useless cpumask_empty() in find_energy_efficient_cpu()
Date: Thu, 11 Sep 2025 12:15:09 +0530 [thread overview]
Message-ID: <8f0c39e3-af68-4f01-94e5-e63ee52864df@linux.ibm.com> (raw)
In-Reply-To: <20250911023426.457745-1-yury.norov@gmail.com>
On 11/09/25 08:04, Yury Norov wrote:
> From: Yury Norov (NVIDIA) <yury.norov@gmail.com>
>
> cpumask_empty() call is O(N) and useless, because the previous
> cpumask_and() returns false for empty 'cpus'.
>
LGTM
Reviewed-by: Madadi Vineeth Reddy <vineethr@linux.ibm.com>
Thanks,
Madadi Vineeth Reddy
> Signed-off-by: Yury Norov (NVIDIA) <yury.norov@gmail.com>
> ---
> kernel/sched/fair.c | 4 +---
> 1 file changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
> index b173a059315c..7229339cbb1b 100644
> --- a/kernel/sched/fair.c
> +++ b/kernel/sched/fair.c
> @@ -8320,9 +8320,7 @@ static int find_energy_efficient_cpu(struct task_struct *p, int prev_cpu)
> int max_spare_cap_cpu = -1;
> int fits, max_fits = -1;
>
> - cpumask_and(cpus, perf_domain_span(pd), cpu_online_mask);
> -
> - if (cpumask_empty(cpus))
> + if (!cpumask_and(cpus, perf_domain_span(pd), cpu_online_mask))
> continue;
>
> /* Account external pressure for the energy estimation */
next prev parent reply other threads:[~2025-09-11 7:20 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-09-11 2:34 [PATCH] sched: fair: drop useless cpumask_empty() in find_energy_efficient_cpu() Yury Norov
2025-09-11 6:44 ` K Prateek Nayak
2025-09-11 6:45 ` Madadi Vineeth Reddy [this message]
2025-09-11 8:28 ` Vincent Guittot
2025-09-11 14:00 ` Markus Elfring
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=8f0c39e3-af68-4f01-94e5-e63ee52864df@linux.ibm.com \
--to=vineethr@linux.ibm.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