]> git.dujemihanovic.xyz Git - linux.git/commitdiff
sched/fair: Fix imbalance overflow
authorVincent Guittot <vincent.guittot@linaro.org>
Tue, 11 Apr 2023 09:06:11 +0000 (11:06 +0200)
committerPeter Zijlstra <peterz@infradead.org>
Wed, 12 Apr 2023 14:46:30 +0000 (16:46 +0200)
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@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/
kernel/sched/fair.c

index 6986ea31c9844719cf083ee1b60e3163add9c9db..5f6587d94c1dd692d2d0cbcf64151e66e690de55 100644 (file)
@@ -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;
+               }
+
        }
 
        /*