From: Shrikanth Hegde <sshegde@linux.ibm.com>
To: mingo@kernel.org, peterz@infradead.org,
vincent.guittot@linaro.org, linux-kernel@vger.kernel.org
Cc: sshegde@linux.ibm.com, kprateek.nayak@amd.com,
juri.lelli@redhat.com, vschneid@redhat.com,
dietmar.eggemann@arm.com, tj@kernel.org, rostedt@goodmis.org,
tglx@kernel.org, mgorman@suse.de, bsegall@google.com,
arighi@nvidia.com
Subject: [PATCH 3/3] sched/fair: Add compile time check in fastpaths for CONFIG_SCHED_SMT=n
Date: Wed, 6 May 2026 16:30:52 +0530 [thread overview]
Message-ID: <20260506110052.9974-4-sshegde@linux.ibm.com> (raw)
In-Reply-To: <20260506110052.9974-1-sshegde@linux.ibm.com>
For fastpaths such as wakeup, load balance even a minimal code additons
can pop up. Add IS_ENABLED checks there to ensure there is no overhead.
Other places are either have sched_smt_active() check or they are not in
fast paths.
Signed-off-by: Shrikanth Hegde <sshegde@linux.ibm.com>
---
kernel/sched/fair.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index d19c416d1b84..cdd7f9633f98 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -1557,6 +1557,9 @@ static inline bool is_core_idle(int cpu)
{
int sibling;
+ if (!IS_ENABLED(CONFIG_SCHED_SMT))
+ return true;
+
for_each_cpu(sibling, cpu_smt_mask(cpu)) {
if (cpu == sibling)
continue;
@@ -11973,7 +11976,8 @@ static int should_we_balance(struct lb_env *env)
* idle has been found, then its not needed to check other
* SMT siblings for idleness:
*/
- cpumask_andnot(swb_cpus, swb_cpus, cpu_smt_mask(cpu));
+ if (IS_ENABLED(CONFIG_SCHED_SMT))
+ cpumask_andnot(swb_cpus, swb_cpus, cpu_smt_mask(cpu));
continue;
}
--
2.51.0
prev parent reply other threads:[~2026-05-06 11:01 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-06 11:00 [PATCH 0/3] sched: Simplify ifdeffery around CONFIG_SCHED_SMT Shrikanth Hegde
2026-05-06 11:00 ` [PATCH 1/3] topology: Introduce cpu_smt_mask for CONFIG_SCHED_SMT=n Shrikanth Hegde
2026-05-06 11:00 ` [PATCH 2/3] sched: Simplify ifdeffery around cpu_smt_mask Shrikanth Hegde
2026-05-11 12:53 ` Valentin Schneider
2026-05-11 14:37 ` Shrikanth Hegde
2026-05-11 18:46 ` Tejun Heo
2026-05-06 11:00 ` Shrikanth Hegde [this message]
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=20260506110052.9974-4-sshegde@linux.ibm.com \
--to=sshegde@linux.ibm.com \
--cc=arighi@nvidia.com \
--cc=bsegall@google.com \
--cc=dietmar.eggemann@arm.com \
--cc=juri.lelli@redhat.com \
--cc=kprateek.nayak@amd.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mgorman@suse.de \
--cc=mingo@kernel.org \
--cc=peterz@infradead.org \
--cc=rostedt@goodmis.org \
--cc=tglx@kernel.org \
--cc=tj@kernel.org \
--cc=vincent.guittot@linaro.org \
--cc=vschneid@redhat.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