The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: K Prateek Nayak <kprateek.nayak@amd.com>
To: Shrikanth Hegde <sshegde@linux.ibm.com>, <mingo@kernel.org>,
	<peterz@infradead.org>, <vincent.guittot@linaro.org>,
	<linux-kernel@vger.kernel.org>
Cc: <juri.lelli@redhat.com>, <vschneid@redhat.com>,
	<dietmar.eggemann@arm.com>, <tj@kernel.org>,
	<rostedt@goodmis.org>, <mgorman@suse.de>, <bsegall@google.com>,
	<arighi@nvidia.com>
Subject: Re: [PATCH v2 3/3] sched/fair: Add compile time check in fastpaths for CONFIG_SCHED_SMT=n
Date: Wed, 13 May 2026 11:37:30 +0530	[thread overview]
Message-ID: <d77b9f47-9017-402b-9814-bcd4b08feb51@amd.com> (raw)
In-Reply-To: <20260512152125.308280-4-sshegde@linux.ibm.com>

Hello Shrikanth,

Thank you for cleaning these bits up! Couple comments below:

On 5/12/2026 8:51 PM, Shrikanth Hegde wrote:
> diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
> index 353e31ecaadc..b6f9592b31fd 100644
> --- a/kernel/sched/fair.c
> +++ b/kernel/sched/fair.c
> @@ -1586,6 +1586,9 @@ static inline bool is_core_idle(int cpu)
>  {
>  	int sibling;
>  
> +	if (!IS_ENABLED(CONFIG_SCHED_SMT))
> +		return true;

I think !sched_smt_active() can also return early here. That said ...

> +
>  	for_each_cpu(sibling, cpu_smt_mask(cpu)) {
>  		if (cpu == sibling)
>  			continue;
> @@ -12003,7 +12006,8 @@ static int should_we_balance(struct lb_env *env)

... I think the if() above can simply check for sched_smt_active()
before calling is_core_idle() like:

    if (sched_smt_active() &&
        !(env->sd->flags & SD_SHARE_CPUCAPACITY) &&
        !is_core_idle(cpu)) {
        ...
    }

That way, we ensure we don't call is_core_idle() and the cpumask_and()
unnecessarily on topologies that don't have SMT domain similar to how
sched_use_asym_prio() guards the call to is_core_idle().

Thoughts?

>  			 * 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;
>  		}
>  

-- 
Thanks and Regards,
Prateek


  parent reply	other threads:[~2026-05-13  6:07 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-12 15:21 [PATCH v2 0/3] sched: Simplify ifdeffery around CONFIG_SCHED_SMT Shrikanth Hegde
2026-05-12 15:21 ` [PATCH v2 1/3] topology: Introduce cpu_smt_mask for CONFIG_SCHED_SMT=n Shrikanth Hegde
2026-05-12 16:56   ` Phil Auld
2026-05-12 15:21 ` [PATCH v2 2/3] sched: Simplify ifdeffery around cpu_smt_mask Shrikanth Hegde
2026-05-12 16:57   ` Phil Auld
2026-05-12 15:21 ` [PATCH v2 3/3] sched/fair: Add compile time check in fastpaths for CONFIG_SCHED_SMT=n Shrikanth Hegde
2026-05-12 16:59   ` Phil Auld
2026-05-13  4:15     ` Shrikanth Hegde
2026-05-13 11:53       ` Phil Auld
2026-05-13  6:07   ` K Prateek Nayak [this message]
2026-05-13  6:16     ` Shrikanth Hegde
2026-05-13  6:39     ` Shrikanth Hegde
2026-05-13  6:57       ` K Prateek Nayak
2026-05-12 17:48 ` [PATCH v2 0/3] sched: Simplify ifdeffery around CONFIG_SCHED_SMT Valentin Schneider
2026-05-13  6:20 ` K Prateek Nayak

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=d77b9f47-9017-402b-9814-bcd4b08feb51@amd.com \
    --to=kprateek.nayak@amd.com \
    --cc=arighi@nvidia.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@kernel.org \
    --cc=peterz@infradead.org \
    --cc=rostedt@goodmis.org \
    --cc=sshegde@linux.ibm.com \
    --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