[PATCH v4 1/6] sched/fair: Do not skip CPUs of similar capacity with busy SMT siblings

From: Ricardo Neri

Date: Mon Jun 08 2026 - 08:48:47 EST


When picking a busiest CPU with only one running task, the function
sched_balance_find_src_rq() skips candidate CPUs if the destination CPU has
less than ~5% extra capacity. This condition only holds if all the SMT
siblings of a CPU are idle.

SMT siblings share the computing resources of a physical core and this
results in reduced capacity if more than one sibling is busy.

Skipping a CPU as described would prevent the load balancer from pulling
tasks from a scheduling group previously and correctly identified as
group_smt_balance (i.e., one with more than one task running).

Do not skip a candidate CPU of similar capacity if it has busy SMT
siblings.

Signed-off-by: Ricardo Neri <ricardo.neri-calderon@xxxxxxxxxxxxxxx>
---
Changes in v4:
* Introduced this patch.

Changes in v3:
* N/A

Changes in v2:
* N/A
---
kernel/sched/fair.c | 5 +++++
1 file changed, 5 insertions(+)

diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index f4ed841f766f..229f32cebf1f 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -12924,6 +12924,7 @@ static struct rq *sched_balance_find_src_rq(struct lb_env *env,
int i;

for_each_cpu_and(i, sched_group_span(group), env->cpus) {
+ bool smt_degraded_cap = sched_smt_active() && !is_core_idle(i);
unsigned long capacity, load, util;
unsigned int nr_running;
enum fbq_type rt;
@@ -12964,8 +12965,12 @@ static struct rq *sched_balance_find_src_rq(struct lb_env *env,
* eventually lead to active_balancing high->low capacity.
* Higher per-CPU capacity is considered better than balancing
* average load.
+ *
+ * Busy SMT siblings reduce the capacity of CPU i. Do not skip
+ * it in this case.
*/
if (env->sd->flags & SD_ASYM_CPUCAPACITY &&
+ !smt_degraded_cap &&
!capacity_greater(capacity_of(env->dst_cpu), capacity) &&
nr_running == 1)
continue;

--
2.43.0