]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
Merge branch 'pm-cpuidle'
authorRafael J. Wysocki <rafael.j.wysocki@intel.com>
Wed, 20 Jan 2016 23:43:21 +0000 (00:43 +0100)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Wed, 20 Jan 2016 23:43:21 +0000 (00:43 +0100)
* pm-cpuidle:
  cpuidle: menu: Avoid pointless checks in menu_select()
  sched / idle: Drop default_idle_call() fallback from call_cpuidle()
  cpuidle: Don't enable all governors by default
  cpuidle: Default to ladder governor on ticking systems
  time: nohz: Expose tick_nohz_enabled
  cpuidle: menu: Fix menu_select() for CPUIDLE_DRIVER_STATE_START == 0

drivers/cpuidle/Kconfig
drivers/cpuidle/cpuidle.c
drivers/cpuidle/governors/ladder.c
drivers/cpuidle/governors/menu.c
include/linux/tick.h
kernel/sched/idle.c
kernel/time/tick-sched.c

index 8c7930b5a65fabaa3ae58c8a2224ed056e1fc95f..7e48eb5bf0a7a1aebb958157c38a0d6b1228a437 100644 (file)
@@ -19,11 +19,9 @@ config CPU_IDLE_MULTIPLE_DRIVERS
 
 config CPU_IDLE_GOV_LADDER
        bool "Ladder governor (for periodic timer tick)"
-       default y
 
 config CPU_IDLE_GOV_MENU
        bool "Menu governor (for tickless system)"
-       default y
 
 config DT_IDLE_STATES
        bool
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 401c0106ed345eda469a590aa345f88d8ff59eca..63bd5a403e22f1a5e30cb633998368c60a1b384c 100644 (file)
@@ -17,6 +17,7 @@
 #include <linux/pm_qos.h>
 #include <linux/module.h>
 #include <linux/jiffies.h>
+#include <linux/tick.h>
 
 #include <asm/io.h>
 #include <asm/uaccess.h>
@@ -184,6 +185,14 @@ static struct cpuidle_governor ladder_governor = {
  */
 static int __init init_ladder(void)
 {
+       /*
+        * When NO_HZ is disabled, or when booting with nohz=off, the ladder
+        * governor is better so give it a higher rating than the menu
+        * governor.
+        */
+       if (!tick_nohz_enabled)
+               ladder_governor.rating = 25;
+
        return cpuidle_register_governor(&ladder_governor);
 }
 
index 7b0971d97cc331e81ac19681029056fc9cda7cd5..0742b32966739cc3a125acd6f28c7e067dc9cb7b 100644 (file)
@@ -294,8 +294,6 @@ static int menu_select(struct cpuidle_driver *drv, struct cpuidle_device *dev)
                data->needs_update = 0;
        }
 
-       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;
@@ -326,20 +324,25 @@ static int menu_select(struct cpuidle_driver *drv, struct cpuidle_device *dev)
        if (latency_req > interactivity_req)
                latency_req = interactivity_req;
 
-       /*
-        * We want to default to C1 (hlt), not to busy polling
-        * unless the timer is happening really really soon.
-        */
-       if (interactivity_req > 20 &&
-           !drv->states[CPUIDLE_DRIVER_STATE_START].disabled &&
-               dev->states_usage[CPUIDLE_DRIVER_STATE_START].disable == 0)
+       if (CPUIDLE_DRIVER_STATE_START > 0) {
+               data->last_state_idx = CPUIDLE_DRIVER_STATE_START - 1;
+               /*
+                * We want to default to C1 (hlt), not to busy polling
+                * unless the timer is happening really really soon.
+                */
+               if (interactivity_req > 20 &&
+                   !drv->states[CPUIDLE_DRIVER_STATE_START].disabled &&
+                       dev->states_usage[CPUIDLE_DRIVER_STATE_START].disable == 0)
+                       data->last_state_idx = CPUIDLE_DRIVER_STATE_START;
+       } else {
                data->last_state_idx = CPUIDLE_DRIVER_STATE_START;
+       }
 
        /*
         * 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];
 
index e312219ff8230bb8a4b8fad60ed4fc0e40a6afd3..97fd4e543846b5f4de1dc5e366f250cc26724098 100644 (file)
@@ -98,6 +98,7 @@ static inline void tick_broadcast_exit(void)
 }
 
 #ifdef CONFIG_NO_HZ_COMMON
+extern int tick_nohz_enabled;
 extern int tick_nohz_tick_stopped(void);
 extern void tick_nohz_idle_enter(void);
 extern void tick_nohz_idle_exit(void);
@@ -106,6 +107,7 @@ extern ktime_t tick_nohz_get_sleep_length(void);
 extern u64 get_cpu_idle_time_us(int cpu, u64 *last_update_time);
 extern u64 get_cpu_iowait_time_us(int cpu, u64 *last_update_time);
 #else /* !CONFIG_NO_HZ_COMMON */
+#define tick_nohz_enabled (0)
 static inline int tick_nohz_tick_stopped(void) { return 0; }
 static inline void tick_nohz_idle_enter(void) { }
 static inline void tick_nohz_idle_exit(void) { }
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.
index 9cc20af58c76300111f23a007b9fd5ad0c8bd60b..9d7a053545f5aca7a324f3530ee52ca9dac413f8 100644 (file)
@@ -387,7 +387,7 @@ void __init tick_nohz_init(void)
 /*
  * NO HZ enabled ?
  */
-static int tick_nohz_enabled __read_mostly  = 1;
+int tick_nohz_enabled __read_mostly = 1;
 unsigned long tick_nohz_active  __read_mostly;
 /*
  * Enable / Disable tickless mode