Skip to content

Commit 111688c

Browse files
aubreyliIngo Molnar
authored andcommitted
sched/fair: Fix negative imbalance in imbalance calculation
A negative imbalance value was observed after imbalance calculation, this happens when the local sched group type is group_fully_busy, and the average load of local group is greater than the selected busiest group. Fix this problem by comparing the average load of the local and busiest group before imbalance calculation formula. Suggested-by: Vincent Guittot <[email protected]> Reviewed-by: Phil Auld <[email protected]> Reviewed-by: Vincent Guittot <[email protected]> Acked-by: Mel Gorman <[email protected]> Signed-off-by: Aubrey Li <[email protected]> Signed-off-by: Peter Zijlstra (Intel) <[email protected]> Signed-off-by: Ingo Molnar <[email protected]> Link: https://lkml.kernel.org/r/[email protected]
1 parent 26a8b12 commit 111688c

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

kernel/sched/fair.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9036,6 +9036,14 @@ static inline void calculate_imbalance(struct lb_env *env, struct sd_lb_stats *s
90369036

90379037
sds->avg_load = (sds->total_load * SCHED_CAPACITY_SCALE) /
90389038
sds->total_capacity;
9039+
/*
9040+
* If the local group is more loaded than the selected
9041+
* busiest group don't try to pull any tasks.
9042+
*/
9043+
if (local->avg_load >= busiest->avg_load) {
9044+
env->imbalance = 0;
9045+
return;
9046+
}
90399047
}
90409048

90419049
/*

0 commit comments

Comments
 (0)