aboutsummaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
authorPeter Zijlstra <a.p.zijlstra@chello.nl>2012-04-20 10:57:22 -0400
committerIngo Molnar <mingo@kernel.org>2012-05-09 09:00:51 -0400
commitc22402a2f76e88b04b7a8b6c0597ad9ba6fd71de (patch)
treedba3b3dc85c1290310968ce78d36ccb9fd670366 /kernel
parentc82513e513556a04f81aa511cd890acd23349c48 (diff)
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>
Diffstat (limited to 'kernel')
-rw-r--r--kernel/sched/fair.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index 678966ca393b..968ffee24721 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,
3781{ 3781{
3782 unsigned long load, max_cpu_load, min_cpu_load, max_nr_running; 3782 unsigned long load, max_cpu_load, min_cpu_load, max_nr_running;
3783 int i; 3783 int i;
3784 unsigned int balance_cpu = -1, first_idle_cpu = 0; 3784 unsigned int balance_cpu = -1;
3785 unsigned long balance_load = ~0UL;
3785 unsigned long avg_load_per_task = 0; 3786 unsigned long avg_load_per_task = 0;
3786 3787
3787 if (local_group) 3788 if (local_group)
@@ -3797,12 +3798,11 @@ static inline void update_sg_lb_stats(struct sched_domain *sd,
3797 3798
3798 /* Bias balancing toward cpus of our domain */ 3799 /* Bias balancing toward cpus of our domain */
3799 if (local_group) { 3800 if (local_group) {
3800 if (idle_cpu(i) && !first_idle_cpu) { 3801 load = target_load(i, load_idx);
3801 first_idle_cpu = 1; 3802 if (load < balance_load || idle_cpu(i)) {
3803 balance_load = load;
3802 balance_cpu = i; 3804 balance_cpu = i;
3803 } 3805 }
3804
3805 load = target_load(i, load_idx);
3806 } else { 3806 } else {
3807 load = source_load(i, load_idx); 3807 load = source_load(i, load_idx);
3808 if (load > max_cpu_load) { 3808 if (load > max_cpu_load) {