From: Srikar Dronamraju <srikar@linux.ibm.com>
To: Ingo Molnar <mingo@kernel.org>,
Peter Zijlstra <peterz@infradead.org>,
Ingo Molnar <mingo@redhat.com>,
Juri Lelli <juri.lelli@redhat.com>,
Vincent Guittot <vincent.guittot@linaro.org>,
Dietmar Eggemann <dietmar.eggemann@arm.com>,
Steven Rostedt <rostedt@goodmis.org>,
Ben Segall <bsegall@google.com>, Mel Gorman <mgorman@suse.de>,
Valentin Schneider <vschneid@redhat.com>,
K Prateek Nayak <kprateek.nayak@amd.com>
Cc: LKML <linux-kernel@vger.kernel.org>,
Srikar Dronamraju <srikar@linux.ibm.com>
Subject: [PATCH 2/3] sched/fair: Use runnable task imbalance for asymmetric groups
Date: Fri, 20 Nov 2026 07:19:49 +0530 [thread overview]
Message-ID: <20261120014946.1355234-7-srikar@linux.ibm.com> (raw)
In-Reply-To: <20261120014946.1355234-5-srikar@linux.ibm.com>
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@linux.ibm.com>
---
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
next prev parent reply other threads:[~2026-11-20 1:50 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-20 1:49 [PATCH 0/3] sched: Fix load accounting and improve imbalance calculation Srikar Dronamraju
2026-11-20 1:49 ` [PATCH 1/3] sched/fair: Exclude delayed-dequeued tasks from sum_nr_running Srikar Dronamraju
2026-11-20 1:49 ` Srikar Dronamraju [this message]
2026-11-20 1:49 ` [PATCH 3/3] sched/topology: Simplify cache_nice_tries initialization Srikar Dronamraju
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=20261120014946.1355234-7-srikar@linux.ibm.com \
--to=srikar@linux.ibm.com \
--cc=bsegall@google.com \
--cc=dietmar.eggemann@arm.com \
--cc=juri.lelli@redhat.com \
--cc=kprateek.nayak@amd.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mgorman@suse.de \
--cc=mingo@kernel.org \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
--cc=rostedt@goodmis.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
all inboxes | Powered by JetHome®