linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Vincent Guittot <vincent.guittot@linaro.org>
To: mingo@redhat.com, peterz@infradead.org, juri.lelli@redhat.com,
	dietmar.eggemann@arm.com, rostedt@goodmis.org,
	bsegall@google.com, mgorman@suse.de, bristot@redhat.com,
	linux-kernel@vger.kernel.org
Cc: odin@uged.al, Vincent Guittot <vincent.guittot@linaro.org>
Subject: [PATCH] sched/pelt: check that *_avg are null when *_sum are
Date: Tue,  1 Jun 2021 17:53:28 +0200	[thread overview]
Message-ID: <20210601155328.19487-1-vincent.guittot@linaro.org> (raw)

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@linaro.org>
---

This is what I used for patch 20210601085832.12626-1-vincent.guittot@linaro.org

 kernel/sched/fair.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index a2c30e52de76..c17feadeafcc 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -8021,6 +8021,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;
 }
 
-- 
2.17.1


             reply	other threads:[~2021-06-01 15:53 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-01 15:53 Vincent Guittot [this message]
2021-06-02  6:45 ` [sched/pelt] e906550aca: WARNING:at_kernel/sched/fair.c:#update_blocked_averages kernel test robot
2021-06-03 10:50   ` Dietmar Eggemann
2021-06-03 10:59     ` Vincent Guittot
2021-06-03 10:42 ` [PATCH] sched/pelt: check that *_avg are null when *_sum are Dietmar Eggemann
2021-06-03 11:06 ` Odin Ugedal
2021-06-03 12:47   ` Vincent Guittot
2021-06-03 14:32     ` Odin Ugedal
2021-06-18  8:46 ` [tip: sched/core] sched/pelt: Check " tip-bot2 for Vincent Guittot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210601155328.19487-1-vincent.guittot@linaro.org \
    --to=vincent.guittot@linaro.org \
    --cc=bristot@redhat.com \
    --cc=bsegall@google.com \
    --cc=dietmar.eggemann@arm.com \
    --cc=juri.lelli@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mgorman@suse.de \
    --cc=mingo@redhat.com \
    --cc=odin@uged.al \
    --cc=peterz@infradead.org \
    --cc=rostedt@goodmis.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).