cpuidle/menu: stop seeking deeper idle if current state is deep enough
authorAlex Shi <alex.shi@linaro.org>
Thu, 12 Jan 2017 13:27:02 +0000 (21:27 +0800)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Mon, 30 Jan 2017 09:56:00 +0000 (10:56 +0100)
Obsolete commit 71abbbf856a0 (cpuidle: extend cpuidle and menu governor
to handle dynamic states) wanted to introduce dynamic C-states, but that
idea was dropped long ago.  The nonsense deeper C-state checking
remained, though.

Since both target_residency and exit_latency are longer for deeper
idle state, there's no need to waste CPU time on useless checks.

Signed-off-by: Alex Shi <alex.shi@linaro.org>
Acked-by: Rik van Riel <riel@redhat.com>
[ rjw: Subject & changelog ]
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
drivers/cpuidle/governors/menu.c

index d9b5b9398a0f67938c7173fa8d4d757c0d67a3ff..07e36bb54006af9c9c065fca2ecf6d45a951c78d 100644 (file)
@@ -357,9 +357,9 @@ static int menu_select(struct cpuidle_driver *drv, struct cpuidle_device *dev)
                if (s->disabled || su->disable)
                        continue;
                if (s->target_residency > data->predicted_us)
-                       continue;
+                       break;
                if (s->exit_latency > latency_req)
-                       continue;
+                       break;
 
                data->last_state_idx = i;
        }