Re: [PATCH v4 1/6] sched/fair: Do not skip CPUs of similar capacity with busy SMT siblings
From: Chen, Yu C
Date: Tue Jun 09 2026 - 02:25:09 EST
On 6/9/2026 12:26 PM, K Prateek Nayak wrote:
Hello Ricardo,
On 6/8/2026 6:27 PM, Ricardo Neri wrote:
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);
Based on a quick look at the generated asm, we seem to be calculating
"smt_degraded_cap" regardless of whether we are on a
"SD_ASYM_CPUCAPACITY" domain or not which is an unnecessary overhead of
doing a is_core_idle() on symmetric domains.
We can have an indicator up top like:
bool asym_balance = !!(env->sd->flags & SD_ASYM_CPUCAPACITY);
and later use that when computing smt_degraded_cap:
bool smt_degraded_cap = asym_balance && (sched_smt_active() && !is_core_idle(i));
I would even suggest pushing this until later and do ...
Right, this can leverage if (!nr_running) to skip the idle i, thus
avoid doing is_core_idle().
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 &&
...
if (asym_balance) {
/* Busy SMT reduces capacity */
if (sched_smt_active() && !is_core_idle(i))
continue;
We might not want to skip i if it has SMT busy siblings?
if ((!sched_smt_active() || is_core_idle(i)) && ...
thanks,
Chenyu