Skip to content

Commit

Permalink
sched/fair: Fix imbalance overflow
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: Vincent Guittot <[email protected]>
Signed-off-by: Peter Zijlstra (Intel) <[email protected]>
Tested-by: Tingjia Cao <[email protected]>
Link: https://lore.kernel.org/lkml/CABcWv9_DAhVBOq2=W=2ypKE9dKM5s2DvoV8-U0+GDwwuKZ89jQ@mail.gmail.com/T/
  • Loading branch information
vingu-linaro authored and Peter Zijlstra committed Apr 12, 2023
1 parent 09a9639 commit 91dcf1e
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions kernel/sched/fair.c
Original file line number Diff line number Diff line change
Expand Up @@ -10238,6 +10238,16 @@ static inline void calculate_imbalance(struct lb_env *env, struct sd_lb_stats *s

sds->avg_load = (sds->total_load * SCHED_CAPACITY_SCALE) /
sds->total_capacity;

/*
* If the local group is more loaded than the average system
* load, don't try to pull any tasks.
*/
if (local->avg_load >= sds->avg_load) {
env->imbalance = 0;
return;
}

}

/*
Expand Down

0 comments on commit 91dcf1e

Please sign in to comment.