diff options
author | zgpeng <zgpeng.linux@gmail.com> | 2022-04-06 17:57:05 +0800 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2023-04-20 12:10:28 +0200 |
commit | 68387ae3b63e7bd1723767ce1bc2186e82490208 (patch) | |
tree | 982b268c3748832e23f7bb875dbbf5e103aa899a | |
parent | ccbec01cc99ce0d3a6851a5cea2fa1c05e536236 (diff) | |
download | linux-stable-68387ae3b63e7bd1723767ce1bc2186e82490208.tar.gz linux-stable-68387ae3b63e7bd1723767ce1bc2186e82490208.tar.bz2 linux-stable-68387ae3b63e7bd1723767ce1bc2186e82490208.zip |
sched/fair: Move calculate of avg_load to a better location
[ Upstream commit 06354900787f25bf5be3c07a68e3cdbc5bf0fa69 ]
In calculate_imbalance function, when the value of local->avg_load is
greater than or equal to busiest->avg_load, the calculated sds->avg_load is
not used. So this calculation can be placed in a more appropriate position.
Signed-off-by: zgpeng <zgpeng@tencent.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Reviewed-by: Samuel Liao <samuelliao@tencent.com>
Reviewed-by: Vincent Guittot <vincent.guittot@linaro.org>
Link: https://lore.kernel.org/r/1649239025-10010-1-git-send-email-zgpeng@tencent.com
Stable-dep-of: 91dcf1e8068e ("sched/fair: Fix imbalance overflow")
Signed-off-by: Sasha Levin <sashal@kernel.org>
-rw-r--r-- | kernel/sched/fair.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index bb70a7856277..22139e97b2a8 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -9342,8 +9342,6 @@ static inline void calculate_imbalance(struct lb_env *env, struct sd_lb_stats *s local->avg_load = (local->group_load * SCHED_CAPACITY_SCALE) / local->group_capacity; - sds->avg_load = (sds->total_load * SCHED_CAPACITY_SCALE) / - sds->total_capacity; /* * If the local group is more loaded than the selected * busiest group don't try to pull any tasks. @@ -9352,6 +9350,9 @@ static inline void calculate_imbalance(struct lb_env *env, struct sd_lb_stats *s env->imbalance = 0; return; } + + sds->avg_load = (sds->total_load * SCHED_CAPACITY_SCALE) / + sds->total_capacity; } /* |