Skip to content

Commit

Permalink
cpuidle: use last_state which can reflect the actual state entered
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Venkatesh Pallipadi authored and Len Brown committed Oct 16, 2008
1 parent 3fa8749 commit 887e301
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion drivers/cpuidle/cpuidle.c
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,11 @@ static void cpuidle_idle_call(void)
target_state = &dev->states[next_state];

/* enter the state and update stats */
dev->last_residency = target_state->enter(dev, target_state);
dev->last_state = target_state;
dev->last_residency = target_state->enter(dev, target_state);
if (dev->last_state)
target_state = dev->last_state;

target_state->time += (unsigned long long)dev->last_residency;
target_state->usage++;

Expand Down

0 comments on commit 887e301

Please sign in to comment.