sched / idle: Drop default_idle_call() fallback from call_cpuidle()
authorRafael J. Wysocki <rafael.j.wysocki@intel.com>
Fri, 15 Jan 2016 23:54:53 +0000 (00:54 +0100)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Tue, 19 Jan 2016 14:27:49 +0000 (15:27 +0100)
After commit 9c4b2867ed7c (cpuidle: menu: Fix menu_select() for
CPUIDLE_DRIVER_STATE_START == 0) it is clear that menu_select()
cannot return negative values.  Moreover, ladder_select_state()
will never return a negative value too, so make find_deepest_state()
return non-negative values too and drop the default_idle_call()
fallback from call_cpuidle().

This eliminates one branch from the idle loop and makes the governors
and find_deepest_state() handle the case when all states have been
disabled from sysfs consistently.

Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Acked-by: Ingo Molnar <mingo@kernel.org>
Tested-by: Sudeep Holla <sudeep.holla@arm.com>
drivers/cpuidle/cpuidle.c
kernel/sched/idle.c

index 17a6dc0e211110f00ac2e73728414f161d5a194f..046423b0c5ca22aad3455101d3cafae7fc4dda87 100644 (file)
@@ -79,9 +79,9 @@ static int find_deepest_state(struct cpuidle_driver *drv,
                              bool freeze)
 {
        unsigned int latency_req = 0;
-       int i, ret = -ENXIO;
+       int i, ret = 0;
 
-       for (i = 0; i < drv->state_count; i++) {
+       for (i = 1; i < drv->state_count; i++) {
                struct cpuidle_state *s = &drv->states[i];
                struct cpuidle_state_usage *su = &dev->states_usage[i];
 
@@ -243,7 +243,7 @@ int cpuidle_enter_state(struct cpuidle_device *dev, struct cpuidle_driver *drv,
  * @drv: the cpuidle driver
  * @dev: the cpuidle device
  *
- * Returns the index of the idle state.
+ * Returns the index of the idle state.  The return value must not be negative.
  */
 int cpuidle_select(struct cpuidle_driver *drv, struct cpuidle_device *dev)
 {
index 4a2ef5a02fd3f91d7c4228378c23d5606bb73812..34852ee70d549848d5793517677c276cdb7e98e5 100644 (file)
@@ -97,12 +97,6 @@ void default_idle_call(void)
 static int call_cpuidle(struct cpuidle_driver *drv, struct cpuidle_device *dev,
                      int next_state)
 {
-       /* Fall back to the default arch idle method on errors. */
-       if (next_state < 0) {
-               default_idle_call();
-               return next_state;
-       }
-
        /*
         * The idle task must be scheduled, it is pointless to go to idle, just
         * update no idle residency and return.