Linux Power Management development
 help / color / mirror / Atom feed
From: Youquan Song <youquan.song@intel.com>
To: linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-pm@lists.linux-foundation.org, len.brown@intel.com,
	akpm@linux-foundation.org
Cc: arjan@linux.intel.com, len.brown@linux.intel.com,
	suresh.b.siddha@intel.com,
	Youquan Song <youquan.song@linux.intel.com>,
	Youquan Song <youquan.song@intel.com>
Subject: [PATCH 3/3] x86,idle: Set residency to 0 if target Cstate not really enter
Date: Fri, 11 May 2012 11:15:57 -0400	[thread overview]
Message-ID: <1336749357-9133-4-git-send-email-youquan.song@intel.com> (raw)
In-Reply-To: <1336749357-9133-3-git-send-email-youquan.song@intel.com>

When cpuidle governor choose a C-state to enter for idle CPU, but it notice that
there is tasks request to be executed. So the idle CPU will not really enter
the target C-state and go to run task.

In this situation, it will use the residency of previous really entered target 
C-states. Obviously, it is not reasonable. 

So, this patch fix it by set the target C-state residency to 0. 

Signed-off-by: Youquan Song <youquan.song@intel.com>
---
 drivers/cpuidle/cpuidle.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)


diff --git a/drivers/cpuidle/cpuidle.c b/drivers/cpuidle/cpuidle.c
index 2f0083a..7992417 100644
--- a/drivers/cpuidle/cpuidle.c
+++ b/drivers/cpuidle/cpuidle.c
@@ -136,6 +136,10 @@ int cpuidle_idle_call(void)
 	/* ask the governor for the next state */
 	next_state = cpuidle_curr_governor->select(drv, dev);
 	if (need_resched()) {
+		dev->last_residency = 0;
+		/* give the governor an opportunity to reflect on the outcome */
+		if (cpuidle_curr_governor->reflect)
+			cpuidle_curr_governor->reflect(dev, next_state);
 		local_irq_enable();
 		return 0;
 	}

      reply	other threads:[~2012-05-11 15:15 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-11 15:15 [PATCH 0/3] x86,idle: Enhance cpuidle prediction to handle its failure Youquan Song
2012-05-11 15:15 ` [PATCH 1/3] x86,idle: Quickly notice prediction failure for repeat mode Youquan Song
2012-05-11 15:15   ` [PATCH 2/3] x86,idle: Quickly notice prediction failure in general case Youquan Song
2012-05-11 15:15     ` Youquan Song [this message]

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=1336749357-9133-4-git-send-email-youquan.song@intel.com \
    --to=youquan.song@intel.com \
    --cc=akpm@linux-foundation.org \
    --cc=arjan@linux.intel.com \
    --cc=len.brown@intel.com \
    --cc=len.brown@linux.intel.com \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@lists.linux-foundation.org \
    --cc=suresh.b.siddha@intel.com \
    --cc=youquan.song@linux.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