diff options
author | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2018-12-03 13:32:53 +0100 |
---|---|---|
committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2018-12-11 12:07:07 +0100 |
commit | 800fb34a99ce7d22dca839c90f869c7a12b50f70 (patch) | |
tree | b680b5950b8a9e998f6108a4f99c16760037b95c /drivers/cpuidle | |
parent | Documentation: admin-guide: PM: Add cpuidle document (diff) | |
download | linux-800fb34a99ce7d22dca839c90f869c7a12b50f70.tar.xz linux-800fb34a99ce7d22dca839c90f869c7a12b50f70.zip |
cpuidle: poll_state: Disregard disable idle states
When computing the limit of time to spend in the loop in poll_idle(),
use the target residency of the first enabled idle state deeper than
state 0 instead of always using the target residency of state 1.
This helps when state 1 is disabled for diagnostics, for instance.
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'drivers/cpuidle')
-rw-r--r-- | drivers/cpuidle/poll_state.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/drivers/cpuidle/poll_state.c b/drivers/cpuidle/poll_state.c index 85792d371add..b17d153e724f 100644 --- a/drivers/cpuidle/poll_state.c +++ b/drivers/cpuidle/poll_state.c @@ -20,8 +20,17 @@ static int __cpuidle poll_idle(struct cpuidle_device *dev, local_irq_enable(); if (!current_set_polling_and_test()) { - u64 limit = (u64)drv->states[1].target_residency * NSEC_PER_USEC; unsigned int loop_count = 0; + u64 limit = TICK_USEC; + int i; + + for (i = 1; i < drv->state_count; i++) { + if (drv->states[i].disabled || dev->states_usage[i].disable) + continue; + + limit = (u64)drv->states[i].target_residency * NSEC_PER_USEC; + break; + } while (!need_resched()) { cpu_relax(); |