aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVenkatesh Pallipadi <venkatesh.pallipadi@intel.com>2008-09-29 18:24:27 -0400
committerLen Brown <len.brown@intel.com>2008-10-16 17:59:44 -0400
commit887e301aa1105326f1412a98749024263b1031c7 (patch)
tree0079a925ac94cb0205858aba07dc2d9714a7ddc4
parent3fa8749e584b55f1180411ab1b51117190bac1e5 (diff)
cpuidle: use last_state which can reflect the actual state entered
cpuidle accounts the idle time for the C-state it was trying to enter and not to the actual state that the driver eventually entered. The driver may select a different state than the one chosen by cpuidle due to constraints like bus-mastering, etc. Change the time acounting code to look at the dev->last_state after returning from target_state->enter(). Driver can modify dev->last_state internally, inside the enter routine to reflect the actual C-state entered. Signed-off-by: Venkatesh Pallipadi <venkatesh.pallipadi@intel.com> Tested-by: Kevin Hilman <khilman@deeprootsystems.com> Signed-off-by: Len Brown <len.brown@intel.com>
-rw-r--r--drivers/cpuidle/cpuidle.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/cpuidle/cpuidle.c b/drivers/cpuidle/cpuidle.c
index 5ce07b517c58..eb2cade562db 100644
--- a/drivers/cpuidle/cpuidle.c
+++ b/drivers/cpuidle/cpuidle.c
@@ -67,8 +67,11 @@ static void cpuidle_idle_call(void)
67 target_state = &dev->states[next_state]; 67 target_state = &dev->states[next_state];
68 68
69 /* enter the state and update stats */ 69 /* enter the state and update stats */
70 dev->last_residency = target_state->enter(dev, target_state);
71 dev->last_state = target_state; 70 dev->last_state = target_state;
71 dev->last_residency = target_state->enter(dev, target_state);
72 if (dev->last_state)
73 target_state = dev->last_state;
74
72 target_state->time += (unsigned long long)dev->last_residency; 75 target_state->time += (unsigned long long)dev->last_residency;
73 target_state->usage++; 76 target_state->usage++;
74 77