This is a note to let you know that I've just added the patch titled sched/fair: Fix imbalance overflow to the 5.10-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: sched-fair-fix-imbalance-overflow.patch and it can be found in the queue-5.10 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. commit 136d511b9163abd01b1b6231b3562ea166e97929 Author: Vincent Guittot <vincent.guittot@xxxxxxxxxx> Date: Tue Apr 11 11:06:11 2023 +0200 sched/fair: Fix imbalance overflow [ Upstream commit 91dcf1e8068e9a8823e419a7a34ff4341275fb70 ] 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: 0b0695f2b34a ("sched/fair: Rework load_balance()") Reported-by: Tingjia Cao <tjcao980311@xxxxxxxxx> Signed-off-by: Vincent Guittot <vincent.guittot@xxxxxxxxxx> Signed-off-by: Peter Zijlstra (Intel) <peterz@xxxxxxxxxxxxx> Tested-by: Tingjia Cao <tjcao980311@xxxxxxxxx> Link: https://lore.kernel.org/lkml/CABcWv9_DAhVBOq2=W=2ypKE9dKM5s2DvoV8-U0+GDwwuKZ89jQ@xxxxxxxxxxxxxx/T/ Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx> diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index 22139e97b2a8e..57a58bc48021a 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -9353,6 +9353,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; + } + } /*