[PATCH 2/3] sched/fair: Use runnable task imbalance for asymmetric groups

From: Srikar Dronamraju

Date: Thu Nov 19 2026 - 20:50:40 EST


The current load-balancing logic uses idle CPU counts to estimate
imbalance when SD_PREFER_SIBLING is not set. This works reasonably well
when groups within a sched_domain are symmetric, since the number of
idle CPUs closely tracks the distribution of runnable tasks.

However, idle CPU counts become misleading when groups contain different
numbers of cores. A larger group naturally has more idle CPUs than a
smaller group, even when its workload is proportionally heavier.

Consider a sched_domain containing two groups:

Group A: 2 cores, 1 runnable task
Group B: 4 cores, 4 runnable tasks

Although Group B is more heavily loaded, it may still report more idle
CPUs simply because it contains more cores. Balancing decisions based on
idle CPU counts can therefore favor the larger group and pull additional
work toward it.

The scheduler already uses runnable task distribution when
SD_PREFER_SIBLING is enabled, as this provides a more accurate view of
load distribution between groups. Apply the same approach when groups
have different numbers of cores and calculate imbalance based on
runnable tasks instead of idle CPU counts.

This improves load balancing on asymmetric topologies and avoids
overestimating the capacity available in larger groups.

Signed-off-by: Srikar Dronamraju <srikar@xxxxxxxxxxxxx>
---
kernel/sched/fair.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index 21f2b17894e3..f5fecbcd2d84 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -13164,7 +13164,8 @@ static inline void calculate_imbalance(struct lb_env *env, struct sd_lb_stats *s
return;
}

- if (busiest->group_weight == 1 || sds->prefer_sibling) {
+ if (busiest->group_weight == 1 || sds->prefer_sibling ||
+ sds->busiest->cores != sds->local->cores) {
/*
* When prefer sibling, evenly spread running tasks on
* groups.
--
2.55.0