@@ -71,12 +71,6 @@ static int ladder_select_state(struct cpuidle_driver *drv,
int last_residency, last_idx = ldev->last_state_idx;
int latency_req = pm_qos_request(PM_QOS_CPU_DMA_LATENCY);
- /* Special case when user has set very strict latency requirement */
- if (unlikely(latency_req == 0)) {
- ladder_do_selection(ldev, last_idx, 0);
- return 0;
- }
-
last_state = &ldev->states[last_idx];
if (drv->states[last_idx].flags & CPUIDLE_FLAG_TIME_VALID) {
@@ -302,10 +302,6 @@ static int menu_select(struct cpuidle_driver *drv, struct cpuidle_device *dev)
data->last_state_idx = CPUIDLE_DRIVER_STATE_START - 1;
- /* Special case when user has set very strict latency requirement */
- if (unlikely(latency_req == 0))
- return 0;
-
/* determine the expected residency time, round up */
data->next_timer_us = ktime_to_us(tick_nohz_get_sleep_length());
@@ -78,6 +78,7 @@ static void cpuidle_idle_call(void)
{
struct cpuidle_device *dev = __this_cpu_read(cpuidle_devices);
struct cpuidle_driver *drv = cpuidle_get_cpu_driver(dev);
+ int latency_req = pm_qos_request(PM_QOS_CPU_DMA_LATENCY);
int next_state, entered_state;
unsigned int broadcast;
@@ -104,6 +105,13 @@ static void cpuidle_idle_call(void)
rcu_idle_enter();
/*
+ * The latency requirement does not allow any latency, jump to
+ * the default idle function
+ */
+ if (latency_req == 0)
+ goto use_default;
+
+ /*
* Ask the cpuidle framework to choose a convenient idle state.
* Fall back to the default arch idle method on errors.
*/
If the zero latency is required, we don't want to invoke any cpuidle code at all. Move the check within the governors and do the check before selecting the state in order to fallback to the default idle function. Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org> --- drivers/cpuidle/governors/ladder.c | 6 ------ drivers/cpuidle/governors/menu.c | 4 ---- kernel/sched/idle.c | 8 ++++++++ 3 files changed, 8 insertions(+), 10 deletions(-)