cpuidle: Set residency to 0 if target Cstate not enter
authorYouquan Song <youquan.song@intel.com>
Fri, 26 Oct 2012 10:26:59 +0000 (12:26 +0200)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Wed, 14 Nov 2012 23:34:20 +0000 (00:34 +0100)
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: Rik van Riel <riel@redhat.com>
Signed-off-by: Youquan Song <youquan.song@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
drivers/cpuidle/cpuidle.c

index f4b8fc50c0f209db24c6a237580b1f2269ae2730..ce4cac706dd163f3ff4fda3c8bcca4e2c24a983f 100644 (file)
@@ -144,6 +144,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;
        }
This page took 0.025117 seconds and 5 git commands to generate.