The following commit has been merged into the sched/core branch of tip: Commit-ID: 9e077b52d86ac364a295b05c916c7478a16865b2 Gitweb: https://git.kernel.org/tip/9e077b52d86ac364a295b05c916c7478a16865b2 Author: Vincent Guittot <vincent.guittot@xxxxxxxxxx> AuthorDate: Tue, 01 Jun 2021 17:53:28 +02:00 Committer: Peter Zijlstra <peterz@xxxxxxxxxxxxx> CommitterDate: Thu, 17 Jun 2021 14:11:42 +02:00 sched/pelt: Check that *_avg are null when *_sum are Check that we never break the rule that pelt's avg values are null if pelt's sum are. Signed-off-by: Vincent Guittot <vincent.guittot@xxxxxxxxxx> Signed-off-by: Peter Zijlstra (Intel) <peterz@xxxxxxxxxxxxx> Reviewed-by: Dietmar Eggemann <dietmar.eggemann@xxxxxxx> Acked-by: Odin Ugedal <odin@xxxxxxx> Link: https://lore.kernel.org/r/20210601155328.19487-1-vincent.guittot@xxxxxxxxxx --- kernel/sched/fair.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index ce625bf..198514d 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -8026,6 +8026,15 @@ static inline bool cfs_rq_is_decayed(struct cfs_rq *cfs_rq) if (cfs_rq->avg.runnable_sum) return false; + /* + * _avg must be null when _sum are null because _avg = _sum / divider + * Make sure that rounding and/or propagation of PELT values never + * break this. + */ + SCHED_WARN_ON(cfs_rq->avg.load_avg || + cfs_rq->avg.util_avg || + cfs_rq->avg.runnable_avg); + return true; }