mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Rik van Riel <riel@redhat.com>
To: linux-kernel@vger.kernel.org
Cc: "Rafael J. Wysocki" <rjw@sisk.pl>,
	ShuoX Liu <shuox.liu@intel.com>,
	mjg59@srcf.ucam.org, Boris Ostrovsky <boris.ostrovsky@amd.com>,
	Len Brown <len.brown@intel.com>,
	Deepthi Dharwar <deepthi@linux.vnet.ibm.com>,
	Arjan van de Ven <arjan@linux.intel.com>
Subject: [RFC][PATCH 3/3] cpuidle: count double the exit latency
Date: Thu, 23 Aug 2012 17:13:56 -0400	[thread overview]
Message-ID: <20120823171356.32d3a807@cuia.bos.redhat.com> (raw)
In-Reply-To: <20120823171104.38574add@cuia.bos.redhat.com>

In some workloads, for example web servers talking to database servers,
a task on one CPU will wake up a task on another CPU, wait for that
other CPU to handle the job, and get the result back.  Each of those
wakeups is likely to incur the c-state exit latency.

By only counting the exit latency once, even though the round trip
involves two c-state exits, we can end up going into too deep a
c-state for the workload.

Signed-off-by: Rik van Riel <riel@redhat.com>
---
 drivers/cpuidle/governors/menu.c |    9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/drivers/cpuidle/governors/menu.c b/drivers/cpuidle/governors/menu.c
index 47b1150..ccdb348 100644
--- a/drivers/cpuidle/governors/menu.c
+++ b/drivers/cpuidle/governors/menu.c
@@ -378,10 +378,13 @@ static void menu_update(struct cpuidle_driver *drv, struct cpuidle_device *dev)
 	/*
 	 * We correct for the exit latency; we are assuming here that the
 	 * exit latency happens after the event that we're interested in.
+	 * Pessimistically assume that we got woken up by another CPU,
+	 * so we count its exit latency, too.
 	 */
-	if (measured_us > data->exit_us)
-		measured_us -= data->exit_us;
-
+	if (measured_us > 2 * data->exit_us)
+		measured_us -= 2 * data->exit_us;
+	else
+		measured_us = 0;
 
 	/* update our correction ratio */
 


  parent reply	other threads:[~2012-08-23 21:13 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-08-23 21:11 [RFC][PATCH 0/3] c-state governor changes Rik van Riel
2012-08-23 21:11 ` [RFC][PATCH 1/3] cpuidle: fix underflow in stddev calculation Rik van Riel
2012-08-23 21:13 ` [RFC][PATCH 2/3] cpuidle: find a typical recent sleep interval Rik van Riel
2012-08-23 21:13 ` Rik van Riel [this message]
2012-08-23 21:54 ` [RFC][PATCH 0/3] c-state governor changes Arjan van de Ven
2012-08-24  2:57   ` Rik van Riel
2012-08-24  4:11   ` Matthew Garrett
2012-08-23 21:54 ` Arjan van de Ven

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=20120823171356.32d3a807@cuia.bos.redhat.com \
    --to=riel@redhat.com \
    --cc=arjan@linux.intel.com \
    --cc=boris.ostrovsky@amd.com \
    --cc=deepthi@linux.vnet.ibm.com \
    --cc=len.brown@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mjg59@srcf.ucam.org \
    --cc=rjw@sisk.pl \
    --cc=shuox.liu@intel.com \
    /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

Powered by JetHome