From: Shrikanth Hegde <sshegde@linux.ibm.com>
To: Valentin Schneider <vschneid@redhat.com>, kprateek.nayak@amd.com
Cc: juri.lelli@redhat.com, dietmar.eggemann@arm.com, tj@kernel.org,
rostedt@goodmis.org, mgorman@suse.de, bsegall@google.com,
arighi@nvidia.com, pauld@redhat.com, mingo@kernel.org,
peterz@infradead.org, vincent.guittot@linaro.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v3 3/4] sched/fair: Add sched_smt_active check for fastpaths
Date: Fri, 15 May 2026 21:04:40 +0530 [thread overview]
Message-ID: <ccafe8f4-6081-454b-8526-25bb0a0b17db@linux.ibm.com> (raw)
In-Reply-To: <xhsmh5x4o3iem.mognet@vschneid-thinkpadt14sgen2i.remote.csb>
Hi Valentin. Thanks for going through the patches.
On 5/15/26 7:05 PM, Valentin Schneider wrote:
> On 13/05/26 19:09, Shrikanth Hegde wrote:
>> For fastpaths such as wakeup and load balance even minimal code additions
>> can add up. is_core_idle is accessed during load balance.
>>
>> Other callsites of is_core_idle make sched_smt_active() check first.
>> Make the same check in should_we_balance.
>>
>> Rest of access to cpu_smt_mask isn't in fastpath.
>>
>> Note: Remove the stale comment above is_core_idle. Enqueue methods
>> of fair aren't close to it anymore.
>>
>> Suggested-by: K Prateek Nayak <kprateek.nayak@amd.com>
>> Signed-off-by: Shrikanth Hegde <sshegde@linux.ibm.com>
>> ---
>> kernel/sched/fair.c | 8 +++-----
>> 1 file changed, 3 insertions(+), 5 deletions(-)
>>
>> diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
>> index 353e31ecaadc..964014a74cf9 100644
>> --- a/kernel/sched/fair.c
>> +++ b/kernel/sched/fair.c
>> @@ -1578,10 +1578,7 @@ update_stats_curr_start(struct cfs_rq *cfs_rq, struct sched_entity *se)
>> se->exec_start = rq_clock_task(rq_of(cfs_rq));
>> }
>>
>> -/**************************************************
>> - * Scheduling class queueing methods:
>> - */
>> -
>> +/* Check sched_smt_active before calling this to avoid overheads in fastpaths */
>> static inline bool is_core_idle(int cpu)
>> {
>> int sibling;
>> @@ -11995,7 +11992,8 @@ static int should_we_balance(struct lb_env *env)
>> * balancing cores, but remember the first idle SMT CPU for
>> * later consideration. Find CPU on an idle core first.
>> */
>> - if (!(env->sd->flags & SD_SHARE_CPUCAPACITY) && !is_core_idle(cpu)) {
>> + if (!(env->sd->flags & SD_SHARE_CPUCAPACITY) &&
>> + sched_smt_active() && !is_core_idle(cpu)) {
>
> Nit: Since that whole if statement is about SMT, you could have the static
> key be the first thing checked in the condition so it can short circuit
> earlier.
Ok. We can do that too.
Only reason i had kept it that way was to avoid
calling it when load balancing at SMT domain assuming sched_smt_active() is
a more common in the field.
I can send out v4 out quickly with below change.
if (sched_smt_active() &&
!(env->sd->flags & SD_SHARE_CPUCAPACITY) &&
!is_core_idle(cpu)) {
That's exactly what prateek had suggested.
next prev parent reply other threads:[~2026-05-15 15:35 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-13 13:39 [PATCH v3 0/4] sched: Simplify CONFIG_SCHED_SMT ifdef usage Shrikanth Hegde
2026-05-13 13:39 ` [PATCH v3 1/4] topology: Introduce cpu_smt_mask for CONFIG_SCHED_SMT=n Shrikanth Hegde
2026-05-13 13:39 ` [PATCH v3 2/4] sched: Simplify ifdeffery around cpu_smt_mask Shrikanth Hegde
2026-05-13 13:39 ` [PATCH v3 3/4] sched/fair: Add sched_smt_active check for fastpaths Shrikanth Hegde
2026-05-15 13:35 ` Valentin Schneider
2026-05-15 15:34 ` Shrikanth Hegde [this message]
2026-05-13 13:39 ` [PATCH v3 4/4] sched: Unify SMT active check via sched_smt_active() Shrikanth Hegde
2026-05-15 14:26 ` Valentin Schneider
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=ccafe8f4-6081-454b-8526-25bb0a0b17db@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=pauld@redhat.com \
--cc=peterz@infradead.org \
--cc=rostedt@goodmis.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
all inboxes | Powered by JetHome®