sched/fair: Make calculate_imbalance() independent
authorPeter Zijlstra <peterz@infradead.org>
Tue, 29 Jul 2014 15:00:21 +0000 (17:00 +0200)
committerIngo Molnar <mingo@kernel.org>
Tue, 12 Aug 2014 10:48:18 +0000 (12:48 +0200)
Rik noticed that calculate_imbalance() relies on
update_sd_pick_busiest() to guarantee that busiest->sum_nr_running >
busiest->group_capacity_factor.

Break this implicit assumption (with the intent of not providing it
anymore) by having calculat_imbalance() verify it and not rely on
others.

Reported-by: Rik van Riel <riel@redhat.com>
Signed-off-by: Peter Zijlstra <peterz@infradead.org>
Acked-by: Vincent Guittot <vincent.guittot@linaro.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: linux-kernel@vger.kernel.org
Link: http://lkml.kernel.org/r/20140729152631.GW12054@laptop.lan
Signed-off-by: Ingo Molnar <mingo@kernel.org>
kernel/sched/fair.c

index bfa3c86d0d6860ccfc53f003b2d5601ae6352e1a..e9477e6193fc2c8fc3af6de32fdf6e7b99ccc1b2 100644 (file)
@@ -6248,7 +6248,7 @@ static inline void calculate_imbalance(struct lb_env *env, struct sd_lb_stats *s
                return fix_small_imbalance(env, sds);
        }
 
-       if (!busiest->group_imb) {
+       if (busiest->sum_nr_running > busiest->group_capacity_factor) {
                /*
                 * Don't want to pull so many tasks that a group would go idle.
                 * Except of course for the group_imb case, since then we might