Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 108573
b: refs/heads/master
c: 320eee7
h: refs/heads/master
i:
  108571: 45e692f
v: v3
  • Loading branch information
venkatesh.pallipadi@intel.com authored and Andi Kleen committed Aug 15, 2008
1 parent 3ddaaff commit 7719e70
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 13 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: a2bd92023357e47f22a34d4cb1635453546662bc
refs/heads/master: 320eee776357db52d6fcfb11cff985b1976a4595
31 changes: 19 additions & 12 deletions trunk/drivers/cpuidle/governors/menu.c
Original file line number Diff line number Diff line change
Expand Up @@ -74,30 +74,37 @@ static void menu_reflect(struct cpuidle_device *dev)
{
struct menu_device *data = &__get_cpu_var(menu_devices);
int last_idx = data->last_state_idx;
unsigned int measured_us =
cpuidle_get_last_residency(dev) + data->elapsed_us;
unsigned int last_idle_us = cpuidle_get_last_residency(dev);
struct cpuidle_state *target = &dev->states[last_idx];
unsigned int measured_us;

/*
* Ugh, this idle state doesn't support residency measurements, so we
* are basically lost in the dark. As a compromise, assume we slept
* for one full standard timer tick. However, be aware that this
* could potentially result in a suboptimal state transition.
*/
if (!(target->flags & CPUIDLE_FLAG_TIME_VALID))
measured_us = USEC_PER_SEC / HZ;
if (unlikely(!(target->flags & CPUIDLE_FLAG_TIME_VALID)))
last_idle_us = USEC_PER_SEC / HZ;

/* Predict time remaining until next break event */
if (measured_us + BREAK_FUZZ < data->expected_us - target->exit_latency) {
data->predicted_us = max(measured_us, data->last_measured_us);
/*
* measured_us and elapsed_us are the cumulative idle time, since the
* last time we were woken out of idle by an interrupt.
*/
if (data->elapsed_us <= data->elapsed_us + last_idle_us)
measured_us = data->elapsed_us + last_idle_us;
else
measured_us = -1;

/* Predict time until next break event */
data->predicted_us = max(measured_us, data->last_measured_us);

if (last_idle_us + BREAK_FUZZ <
data->expected_us - target->exit_latency) {
data->last_measured_us = measured_us;
data->elapsed_us = 0;
} else {
if (data->elapsed_us < data->elapsed_us + measured_us)
data->elapsed_us = measured_us;
else
data->elapsed_us = -1;
data->predicted_us = max(measured_us, data->last_measured_us);
data->elapsed_us = measured_us;
}
}

Expand Down

0 comments on commit 7719e70

Please sign in to comment.