public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: tip-bot for Jason Low <tipbot@zytor.com>
To: linux-tip-commits@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, hpa@zytor.com, mingo@kernel.org,
	peterz@infradead.org, jason.low2@hp.com, riel@redhat.com,
	srikar@linux.vnet.ibm.com, tglx@linutronix.de
Subject: [tip:sched/core] sched: Reduce overestimating rq->avg_idle
Date: Fri, 20 Sep 2013 06:47:19 -0700	[thread overview]
Message-ID: <tip-abfafa54db9aba404e8e6763503f04d35bd07138@git.kernel.org> (raw)
In-Reply-To: <1379096813-3032-2-git-send-email-jason.low2@hp.com>

Commit-ID:  abfafa54db9aba404e8e6763503f04d35bd07138
Gitweb:     http://git.kernel.org/tip/abfafa54db9aba404e8e6763503f04d35bd07138
Author:     Jason Low <jason.low2@hp.com>
AuthorDate: Fri, 13 Sep 2013 11:26:51 -0700
Committer:  Ingo Molnar <mingo@kernel.org>
CommitDate: Fri, 20 Sep 2013 12:03:41 +0200

sched: Reduce overestimating rq->avg_idle

When updating avg_idle, if the delta exceeds some max value, then avg_idle
gets set to the max, regardless of what the previous avg was. This can cause
avg_idle to often be overestimated.

This patch modifies the way we update avg_idle by always updating it with the
function call to update_avg() first. Then, if avg_idle exceeds the max, we set
it to the max.

Signed-off-by: Jason Low <jason.low2@hp.com>
Reviewed-by: Rik van Riel <riel@redhat.com>
Reviewed-by: Srikar Dronamraju <srikar@linux.vnet.ibm.com>
Signed-off-by: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/1379096813-3032-2-git-send-email-jason.low2@hp.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
 kernel/sched/core.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index 5ac63c9..048f39e 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -1332,10 +1332,11 @@ ttwu_do_wakeup(struct rq *rq, struct task_struct *p, int wake_flags)
 		u64 delta = rq_clock(rq) - rq->idle_stamp;
 		u64 max = 2*sysctl_sched_migration_cost;
 
-		if (delta > max)
+		update_avg(&rq->avg_idle, delta);
+
+		if (rq->avg_idle > max)
 			rq->avg_idle = max;
-		else
-			update_avg(&rq->avg_idle, delta);
+
 		rq->idle_stamp = 0;
 	}
 #endif

  reply	other threads:[~2013-09-20 13:48 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-13 18:26 [PATCH v5 0/3] sched: Limiting idle balance Jason Low
2013-09-13 18:26 ` [PATCH v5 1/3] sched: Reduce overestimating rq->avg_idle Jason Low
2013-09-20 13:47   ` tip-bot for Jason Low [this message]
2013-09-13 18:26 ` [PATCH v5 2/3] sched: Consider max cost of idle balance per sched domain Jason Low
2013-09-20 13:47   ` [tip:sched/core] sched/balancing: " tip-bot for Jason Low
2013-09-13 18:26 ` [PATCH v5 3/3] sched: Periodically decay max cost of idle balance Jason Low
2013-09-20 13:47   ` [tip:sched/core] sched/balancing: " tip-bot for Jason Low

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=tip-abfafa54db9aba404e8e6763503f04d35bd07138@git.kernel.org \
    --to=tipbot@zytor.com \
    --cc=hpa@zytor.com \
    --cc=jason.low2@hp.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=peterz@infradead.org \
    --cc=riel@redhat.com \
    --cc=srikar@linux.vnet.ibm.com \
    --cc=tglx@linutronix.de \
    /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