All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/3] Use the ladder cpuidle governor when appropriate
@ 2016-01-11 16:39 Jean Delvare
  2016-01-11 16:40 ` [PATCH 1/3] Subject: nohz: Expose tick_nohz_enabled Jean Delvare
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Jean Delvare @ 2016-01-11 16:39 UTC (permalink / raw)
  To: linux-pm; +Cc: Thomas Gleixner, Zhang Rui, Rafael J. Wysocki, Daniel Lezcano

Hi all,

This is my attempt to fix:
https://bugzilla.kernel.org/show_bug.cgi?id=65531

[PATCH 1/3] nohz: Expose tick_nohz_enabled
[PATCH 2/3] cpuidle: Default to ladder governor on ticking systems
[PATCH 3/3] cpuidle: Don't enable all governors by default
-- 
Jean Delvare
SUSE L3 Support

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 1/3] Subject: nohz: Expose tick_nohz_enabled
  2016-01-11 16:39 [PATCH 0/3] Use the ladder cpuidle governor when appropriate Jean Delvare
@ 2016-01-11 16:40 ` Jean Delvare
  2016-01-11 16:44   ` Jean Delvare
  2016-01-11 17:10   ` Thomas Gleixner
  2016-01-11 16:41 ` [PATCH 2/3] cpuidle: Default to ladder governor on ticking systems Jean Delvare
  2016-01-11 16:43 ` [PATCH 3/3] cpuidle: Don't enable all governors by default Jean Delvare
  2 siblings, 2 replies; 6+ messages in thread
From: Jean Delvare @ 2016-01-11 16:40 UTC (permalink / raw)
  To: linux-pm; +Cc: Thomas Gleixner, Zhang Rui, Rafael J. Wysocki, Daniel Lezcano

The cpuidle subsystem needs it.

Signed-off-by: Jean Delvare <jdelvare@suse.de>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Zhang Rui <rui.zhang@intel.com>
---
 include/linux/tick.h     |    2 ++
 kernel/time/tick-sched.c |    2 +-
 2 files changed, 3 insertions(+), 1 deletion(-)

--- linux-4.4.orig/include/linux/tick.h	2016-01-11 00:01:32.000000000 +0100
+++ linux-4.4/include/linux/tick.h	2016-01-11 15:10:46.334547548 +0100
@@ -98,6 +98,7 @@ static inline void tick_broadcast_exit(v
 }
 
 #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_lengt
 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) { }
--- linux-4.4.orig/kernel/time/tick-sched.c	2016-01-11 15:06:54.776653477 +0100
+++ linux-4.4/kernel/time/tick-sched.c	2016-01-11 15:09:19.022700899 +0100
@@ -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

-- 
Jean Delvare
SUSE L3 Support

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 2/3] cpuidle: Default to ladder governor on ticking systems
  2016-01-11 16:39 [PATCH 0/3] Use the ladder cpuidle governor when appropriate Jean Delvare
  2016-01-11 16:40 ` [PATCH 1/3] Subject: nohz: Expose tick_nohz_enabled Jean Delvare
@ 2016-01-11 16:41 ` Jean Delvare
  2016-01-11 16:43 ` [PATCH 3/3] cpuidle: Don't enable all governors by default Jean Delvare
  2 siblings, 0 replies; 6+ messages in thread
From: Jean Delvare @ 2016-01-11 16:41 UTC (permalink / raw)
  To: linux-pm; +Cc: Thomas Gleixner, Zhang Rui, Rafael J. Wysocki, Daniel Lezcano

The menu governor is currently the default on all systems. However the
documentation claims that the ladder governor is preferred on ticking
systems. So bump the rating of the ladder governor when NO_HZ is
disabled, or when booting with nohz=off.

This fixes the first half of bug #65531:
https://bugzilla.kernel.org/show_bug.cgi?id=65531

Signed-off-by: Jean Delvare <jdelvare@suse.de>
Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net>
Cc: Daniel Lezcano <daniel.lezcano@linaro.org>
Cc: Zhang Rui <rui.zhang@intel.com>
---
 drivers/cpuidle/governors/ladder.c |    9 +++++++++
 1 file changed, 9 insertions(+)

--- linux-4.4.orig/drivers/cpuidle/governors/ladder.c	2016-01-11 16:14:57.962027330 +0100
+++ linux-4.4/drivers/cpuidle/governors/ladder.c	2016-01-11 16:15:57.217301178 +0100
@@ -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_go
  */
 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);
 }
 

-- 
Jean Delvare
SUSE L3 Support

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 3/3] cpuidle: Don't enable all governors by default
  2016-01-11 16:39 [PATCH 0/3] Use the ladder cpuidle governor when appropriate Jean Delvare
  2016-01-11 16:40 ` [PATCH 1/3] Subject: nohz: Expose tick_nohz_enabled Jean Delvare
  2016-01-11 16:41 ` [PATCH 2/3] cpuidle: Default to ladder governor on ticking systems Jean Delvare
@ 2016-01-11 16:43 ` Jean Delvare
  2 siblings, 0 replies; 6+ messages in thread
From: Jean Delvare @ 2016-01-11 16:43 UTC (permalink / raw)
  To: linux-pm; +Cc: Thomas Gleixner, Zhang Rui, Rafael J. Wysocki, Daniel Lezcano

Since commit d6f346f2d2 ("cpuidle: improve governor Kconfig options")
the best cpuidle governor is selected automatically. There is little
point in additionally selecting the other as it will not be used. So
don't make it the default.

Being able to select more than one governor is still good for
developers booting with cpuidle_sysfs_switch.

This fixes the second half of bug #65531:
https://bugzilla.kernel.org/show_bug.cgi?id=65531

Signed-off-by: Jean Delvare <jdelvare@suse.de>
Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net>
Cc: Daniel Lezcano <daniel.lezcano@linaro.org>
Cc: Zhang Rui <rui.zhang@intel.com>
---
 drivers/cpuidle/Kconfig |    2 --
 1 file changed, 2 deletions(-)

--- linux-4.4.orig/drivers/cpuidle/Kconfig	2016-01-11 00:01:32.000000000 +0100
+++ linux-4.4/drivers/cpuidle/Kconfig	2016-01-11 17:06:44.294720023 +0100
@@ -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

-- 
Jean Delvare
SUSE L3 Support

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 1/3] Subject: nohz: Expose tick_nohz_enabled
  2016-01-11 16:40 ` [PATCH 1/3] Subject: nohz: Expose tick_nohz_enabled Jean Delvare
@ 2016-01-11 16:44   ` Jean Delvare
  2016-01-11 17:10   ` Thomas Gleixner
  1 sibling, 0 replies; 6+ messages in thread
From: Jean Delvare @ 2016-01-11 16:44 UTC (permalink / raw)
  To: linux-pm; +Cc: Thomas Gleixner, Zhang Rui, Rafael J. Wysocki, Daniel Lezcano

Bah, sorry for the wonky subject :(

-- 
Jean Delvare
SUSE L3 Support

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 1/3] Subject: nohz: Expose tick_nohz_enabled
  2016-01-11 16:40 ` [PATCH 1/3] Subject: nohz: Expose tick_nohz_enabled Jean Delvare
  2016-01-11 16:44   ` Jean Delvare
@ 2016-01-11 17:10   ` Thomas Gleixner
  1 sibling, 0 replies; 6+ messages in thread
From: Thomas Gleixner @ 2016-01-11 17:10 UTC (permalink / raw)
  To: Jean Delvare; +Cc: linux-pm, Zhang Rui, Rafael J. Wysocki, Daniel Lezcano

On Mon, 11 Jan 2016, Jean Delvare wrote:

> The cpuidle subsystem needs it.
> 
> Signed-off-by: Jean Delvare <jdelvare@suse.de>
> Cc: Thomas Gleixner <tglx@linutronix.de>
> Cc: Zhang Rui <rui.zhang@intel.com>

Reviewed-by: Thomas Gleixner <tglx@linutronix.de>

> ---
>  include/linux/tick.h     |    2 ++
>  kernel/time/tick-sched.c |    2 +-
>  2 files changed, 3 insertions(+), 1 deletion(-)
> 
> --- linux-4.4.orig/include/linux/tick.h	2016-01-11 00:01:32.000000000 +0100
> +++ linux-4.4/include/linux/tick.h	2016-01-11 15:10:46.334547548 +0100
> @@ -98,6 +98,7 @@ static inline void tick_broadcast_exit(v
>  }
>  
>  #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_lengt
>  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) { }
> --- linux-4.4.orig/kernel/time/tick-sched.c	2016-01-11 15:06:54.776653477 +0100
> +++ linux-4.4/kernel/time/tick-sched.c	2016-01-11 15:09:19.022700899 +0100
> @@ -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
> 
> -- 
> Jean Delvare
> SUSE L3 Support
> 

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2016-01-11 17:11 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-01-11 16:39 [PATCH 0/3] Use the ladder cpuidle governor when appropriate Jean Delvare
2016-01-11 16:40 ` [PATCH 1/3] Subject: nohz: Expose tick_nohz_enabled Jean Delvare
2016-01-11 16:44   ` Jean Delvare
2016-01-11 17:10   ` Thomas Gleixner
2016-01-11 16:41 ` [PATCH 2/3] cpuidle: Default to ladder governor on ticking systems Jean Delvare
2016-01-11 16:43 ` [PATCH 3/3] cpuidle: Don't enable all governors by default Jean Delvare

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.