From: tip-bot for Peter Zijlstra <a.p.zijlstra@chello.nl>
To: linux-tip-commits@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, hpa@zytor.com, mingo@kernel.org,
a.p.zijlstra@chello.nl, tglx@linutronix.de
Subject: [tip:sched/core] sched/fair: Let minimally loaded cpu balance the group
Date: Wed, 9 May 2012 07:26:31 -0700 [thread overview]
Message-ID: <tip-v8zlrmgmkne3bkcy9dej1fvm@git.kernel.org> (raw)
Commit-ID: c22402a2f76e88b04b7a8b6c0597ad9ba6fd71de
Gitweb: http://git.kernel.org/tip/c22402a2f76e88b04b7a8b6c0597ad9ba6fd71de
Author: Peter Zijlstra <a.p.zijlstra@chello.nl>
AuthorDate: Fri, 20 Apr 2012 16:57:22 +0200
Committer: Ingo Molnar <mingo@kernel.org>
CommitDate: Wed, 9 May 2012 15:00:51 +0200
sched/fair: Let minimally loaded cpu balance the group
Currently we let the leftmost (or first idle) cpu ascend the
sched_domain tree and perform load-balancing. The result is that the
busiest cpu in the group might be performing this function and pull
more load to itself. The next load balance pass will then try to
equalize this again.
Change this to pick the least loaded cpu to perform higher domain
balancing.
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/n/tip-v8zlrmgmkne3bkcy9dej1fvm@git.kernel.org
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
kernel/sched/fair.c | 10 +++++-----
1 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index 678966c..968ffee 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -3781,7 +3781,8 @@ static inline void update_sg_lb_stats(struct sched_domain *sd,
{
unsigned long load, max_cpu_load, min_cpu_load, max_nr_running;
int i;
- unsigned int balance_cpu = -1, first_idle_cpu = 0;
+ unsigned int balance_cpu = -1;
+ unsigned long balance_load = ~0UL;
unsigned long avg_load_per_task = 0;
if (local_group)
@@ -3797,12 +3798,11 @@ static inline void update_sg_lb_stats(struct sched_domain *sd,
/* Bias balancing toward cpus of our domain */
if (local_group) {
- if (idle_cpu(i) && !first_idle_cpu) {
- first_idle_cpu = 1;
+ load = target_load(i, load_idx);
+ if (load < balance_load || idle_cpu(i)) {
+ balance_load = load;
balance_cpu = i;
}
-
- load = target_load(i, load_idx);
} else {
load = source_load(i, load_idx);
if (load > max_cpu_load) {
next reply other threads:[~2012-05-09 14:26 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-05-09 14:26 tip-bot for Peter Zijlstra [this message]
2012-05-09 20:39 ` [tip:sched/core] sched/fair: Let minimally loaded cpu balance the group Peter Zijlstra
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=tip-v8zlrmgmkne3bkcy9dej1fvm@git.kernel.org \
--to=a.p.zijlstra@chello.nl \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tip-commits@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=tglx@linutronix.de \
/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