diff options
author | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2018-10-03 00:42:56 +0300 |
---|---|---|
committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2018-10-04 20:24:14 +0300 |
commit | 23e8ceb9ce766c81d62434053aef6e7efea6fcc3 (patch) | |
tree | 0d7d20b5ba6677db8076fd92f839a098d5c77752 /drivers/cpuidle/governors | |
parent | 5f26bdceb9c0a5e6c696aa2899d077cd3ae93413 (diff) | |
download | linux-23e8ceb9ce766c81d62434053aef6e7efea6fcc3.tar.xz |
cpuidle: menu: Compute first_idx when latency_req is known
Since menu_select() can only set first_idx to 1 if the exit latency
of the second state is not greater than the latency limit, it should
first determine that limit. Thus first_idx should be computed after
the "interactivity" factor has been taken into account.
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Reviewedy-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Diffstat (limited to 'drivers/cpuidle/governors')
-rw-r--r-- | drivers/cpuidle/governors/menu.c | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/drivers/cpuidle/governors/menu.c b/drivers/cpuidle/governors/menu.c index 8b3f9c7bf221..98a39c57acec 100644 --- a/drivers/cpuidle/governors/menu.c +++ b/drivers/cpuidle/governors/menu.c @@ -322,22 +322,6 @@ static int menu_select(struct cpuidle_driver *drv, struct cpuidle_device *dev, expected_interval = get_typical_interval(data); expected_interval = min(expected_interval, data->next_timer_us); - first_idx = 0; - if (drv->states[0].flags & CPUIDLE_FLAG_POLLING) { - struct cpuidle_state *s = &drv->states[1]; - unsigned int polling_threshold; - - /* - * Default to a physical idle state, not to busy polling, unless - * a timer is going to trigger really really soon. - */ - polling_threshold = max_t(unsigned int, 20, s->target_residency); - if (data->next_timer_us > polling_threshold && - latency_req > s->exit_latency && !s->disabled && - !dev->states_usage[1].disable) - first_idx = 1; - } - /* * Use the lowest expected idle interval to pick the idle state. */ @@ -364,6 +348,22 @@ static int menu_select(struct cpuidle_driver *drv, struct cpuidle_device *dev, latency_req = interactivity_req; } + first_idx = 0; + if (drv->states[0].flags & CPUIDLE_FLAG_POLLING) { + struct cpuidle_state *s = &drv->states[1]; + unsigned int polling_threshold; + + /* + * Default to a physical idle state, not to busy polling, unless + * a timer is going to trigger really really soon. + */ + polling_threshold = max_t(unsigned int, 20, s->target_residency); + if (data->next_timer_us > polling_threshold && + latency_req > s->exit_latency && !s->disabled && + !dev->states_usage[1].disable) + first_idx = 1; + } + /* * Find the idle state with the lowest power while satisfying * our constraints. |