Skip to content

Commit 91dcf1e

Browse files
vingu-linaroPeter Zijlstra
authored andcommitted
sched/fair: Fix imbalance overflow
When local group is fully busy but its average load is above system load, computing the imbalance will overflow and local group is not the best target for pulling this load. Fixes: 0b0695f ("sched/fair: Rework load_balance()") Reported-by: Tingjia Cao <tjcao980311@gmail.com> Signed-off-by: Vincent Guittot <vincent.guittot@linaro.org> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Tested-by: Tingjia Cao <tjcao980311@gmail.com> Link: https://lore.kernel.org/lkml/CABcWv9_DAhVBOq2=W=2ypKE9dKM5s2DvoV8-U0+GDwwuKZ89jQ@mail.gmail.com/T/
1 parent 09a9639 commit 91dcf1e

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

kernel/sched/fair.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10238,6 +10238,16 @@ static inline void calculate_imbalance(struct lb_env *env, struct sd_lb_stats *s
1023810238

1023910239
sds->avg_load = (sds->total_load * SCHED_CAPACITY_SCALE) /
1024010240
sds->total_capacity;
10241+
10242+
/*
10243+
* If the local group is more loaded than the average system
10244+
* load, don't try to pull any tasks.
10245+
*/
10246+
if (local->avg_load >= sds->avg_load) {
10247+
env->imbalance = 0;
10248+
return;
10249+
}
10250+
1024110251
}
1024210252

1024310253
/*

0 commit comments

Comments
 (0)