diff options
author | kuyo chang <kuyo.chang@mediatek.com> | 2022-04-14 12:02:20 +0300 |
---|---|---|
committer | Peter Zijlstra <peterz@infradead.org> | 2022-04-19 22:15:41 +0300 |
commit | 40f5aa4c5eaebfeaca4566217cb9c468e28ed682 (patch) | |
tree | 030ff237ce759d040bdb01ebe5420bc2ed330516 /fs/notify/inotify | |
parent | b2d229d4ddb17db541098b83524d901257e93845 (diff) | |
download | linux-40f5aa4c5eaebfeaca4566217cb9c468e28ed682.tar.xz |
sched/pelt: Fix attach_entity_load_avg() corner case
The warning in cfs_rq_is_decayed() triggered:
SCHED_WARN_ON(cfs_rq->avg.load_avg ||
cfs_rq->avg.util_avg ||
cfs_rq->avg.runnable_avg)
There exists a corner case in attach_entity_load_avg() which will
cause load_sum to be zero while load_avg will not be.
Consider se_weight is 88761 as per the sched_prio_to_weight[] table.
Further assume the get_pelt_divider() is 47742, this gives:
se->avg.load_avg is 1.
However, calculating load_sum:
se->avg.load_sum = div_u64(se->avg.load_avg * se->avg.load_sum, se_weight(se));
se->avg.load_sum = 1*47742/88761 = 0.
Then enqueue_load_avg() adds this to the cfs_rq totals:
cfs_rq->avg.load_avg += se->avg.load_avg;
cfs_rq->avg.load_sum += se_weight(se) * se->avg.load_sum;
Resulting in load_avg being 1 with load_sum is 0, which will trigger
the WARN.
Fixes: f207934fb79d ("sched/fair: Align PELT windows between cfs_rq and its se")
Signed-off-by: kuyo chang <kuyo.chang@mediatek.com>
[peterz: massage changelog]
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Reviewed-by: Vincent Guittot <vincent.guittot@linaro.org>
Tested-by: Dietmar Eggemann <dietmar.eggemann@arm.com>
Link: https://lkml.kernel.org/r/20220414090229.342-1-kuyo.chang@mediatek.com
Diffstat (limited to 'fs/notify/inotify')
0 files changed, 0 insertions, 0 deletions