Re: [PATCH v2 3/3] sched/fair: Add compile time check in fastpaths for CONFIG_SCHED_SMT=n

From: Phil Auld

Date: Tue May 12 2026 - 13:03:33 EST


Hi Shrikanth,

On Tue, May 12, 2026 at 08:51:25PM +0530 Shrikanth Hegde wrote:
> 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.

"For fastpaths such as wakeup and load balance, even minimal code additions
can add up. Add IS_ENABLED() checks..." ?

>
> Other places are either have sched_smt_active() check or they are not in

s/are//

"have a sched_smt_active_check()" or drop "check" ?


Otherwise lgtm.

Reviewed-by: Phil Auld <pauld@xxxxxxxxxx>


Cheers,
Phil



> fast paths.
>
> Signed-off-by: Shrikanth Hegde <sshegde@xxxxxxxxxxxxx>
> ---
> 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 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;
> +
> 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)
> * 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.47.3
>
>

--