]> Git Repo - linux.git/commitdiff
cpuidle: menu: Avoid pointless checks in menu_select()
authorRafael J. Wysocki <[email protected]>
Fri, 15 Jan 2016 23:56:34 +0000 (00:56 +0100)
committerRafael J. Wysocki <[email protected]>
Tue, 19 Jan 2016 14:28:23 +0000 (15:28 +0100)
If menu_select() cannot find a suitable state to return, it will
return the state index stored in data->last_state_idx.  This
means that it is pointless to look at the states whose indices
are less than or equal to data->last_state_idx in the main loop,
so don't do that.

Given that those checks are done on every idle state selection, this
change can save quite a bit of completely unnecessary overhead.

Signed-off-by: Rafael J. Wysocki <[email protected]>
Acked-by: Ingo Molnar <[email protected]>
Tested-by: Sudeep Holla <[email protected]>
drivers/cpuidle/governors/menu.c

index be0bae0b41e9b06764fee021c46a8323533da45e..0742b32966739cc3a125acd6f28c7e067dc9cb7b 100644 (file)
@@ -342,7 +342,7 @@ static int menu_select(struct cpuidle_driver *drv, struct cpuidle_device *dev)
         * Find the idle state with the lowest power while satisfying
         * our constraints.
         */
-       for (i = CPUIDLE_DRIVER_STATE_START; i < drv->state_count; i++) {
+       for (i = data->last_state_idx + 1; i < drv->state_count; i++) {
                struct cpuidle_state *s = &drv->states[i];
                struct cpuidle_state_usage *su = &dev->states_usage[i];
 
This page took 0.055216 seconds and 4 git commands to generate.