diff options
| author | xupengbo <xupengbo@oppo.com> | 2025-08-27 10:22:07 +0800 |
|---|---|---|
| committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2025-12-18 14:03:32 +0100 |
| commit | 8061d3b7bb917812c697f25495cb015d3a6c42e8 (patch) | |
| tree | 6daec47d07ccaff3db502c18ace97112d0588a5d /kernel | |
| parent | fe9a3154bb5b020f0fe9ddb661560f37ebaff5da (diff) | |
| download | linux-8061d3b7bb917812c697f25495cb015d3a6c42e8.tar.gz linux-8061d3b7bb917812c697f25495cb015d3a6c42e8.tar.bz2 linux-8061d3b7bb917812c697f25495cb015d3a6c42e8.zip | |
sched/fair: Fix unfairness caused by stalled tg_load_avg_contrib when the last task migrates out
[ Upstream commit ca125231dd29fc0678dd3622e9cdea80a51dffe4 ]
When a task is migrated out, there is a probability that the tg->load_avg
value will become abnormal. The reason is as follows:
1. Due to the 1ms update period limitation in update_tg_load_avg(), there
is a possibility that the reduced load_avg is not updated to tg->load_avg
when a task migrates out.
2. Even though __update_blocked_fair() traverses the leaf_cfs_rq_list and
calls update_tg_load_avg() for cfs_rqs that are not fully decayed, the key
function cfs_rq_is_decayed() does not check whether
cfs->tg_load_avg_contrib is null. Consequently, in some cases,
__update_blocked_fair() removes cfs_rqs whose avg.load_avg has not been
updated to tg->load_avg.
Add a check of cfs_rq->tg_load_avg_contrib in cfs_rq_is_decayed(),
which fixes the case (2.) mentioned above.
Fixes: 1528c661c24b ("sched/fair: Ratelimit update to tg->load_avg")
Signed-off-by: xupengbo <xupengbo@oppo.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Reviewed-by: Aaron Lu <ziqianlu@bytedance.com>
Reviewed-by: Vincent Guittot <vincent.guittot@linaro.org>
Tested-by: Aaron Lu <ziqianlu@bytedance.com>
Link: https://patch.msgid.link/20250827022208.14487-1-xupengbo@oppo.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'kernel')
| -rw-r--r-- | kernel/sched/fair.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index 2a4a1c6e25da..71d3f4125b0e 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -4059,6 +4059,9 @@ static inline bool cfs_rq_is_decayed(struct cfs_rq *cfs_rq) if (child_cfs_rq_on_list(cfs_rq)) return false; + if (cfs_rq->tg_load_avg_contrib) + return false; + return true; } |
