Skip to contentSkip to conversation

cpuidle: disable menu governor if nohz is disabled

RFC In review Shaohua Li 3 participants 4 messages Aug 31, 2011

Subsystems (3)
lore
Share & tools
lore

Shaohua Li

author
#0 lore raw

RFC 1/1 cpuidle: disable menu governor if nohz is disabled

Lenb,
Aubrey is asking me to fix the issue. So either we delete disable nohz code or fix cpuidle. if you want to fix cpuidle, here it is.

Thanks,
SHaohua

Subject: cpuidle: disable menu governor if nohz is disabled

Aubrey is asking why nohz disables C-state. nohz has no dependency with idle, but menu governor does. If nohz is disabled, using menu governor is pointless, because we never get correct sleep length, so let's use ladder governor just like nohz isn't compiled in.

Frankly, disabling nohz is strange, but in case somebody cares, here is the fix.

drivers/cpuidle/governors/menu.c +2 -0
index c47f3d0..cbf9afa 100644
@@ -408,6 +408,8 @@ static struct cpuidle_governor menu_governor = {
  */
 static int __init init_menu(void)
 {
+	if (!tick_nohz_enabled)
+		return 0;
 	return cpuidle_register_governor(&menu_governor);
 }
 
include/linux/tick.h +1 -0
index b232ccc..88895c7 100644
@@ -126,6 +126,7 @@ extern void tick_nohz_restart_sched_tick(void);
 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);
+extern int tick_nohz_enabled;
 # else
 static inline void tick_nohz_stop_sched_tick(int inidle) { }
 static inline void tick_nohz_restart_sched_tick(void) { }
kernel/time/tick-sched.c +1 -1
index d5097c4..6a270fe 100644
@@ -105,7 +105,7 @@ static ktime_t tick_init_jiffy_update(void)
 /*
  * NO HZ enabled ?
  */
-static int tick_nohz_enabled __read_mostly  = 1;
+int tick_nohz_enabled __read_mostly  = 1;
 
 /*
  * Enable / Disable tickless mode
#1 lore raw

this one works, thanks shaohua!

Quoted 65 lines

-----Original Message-----
From: Li, Shaohua
Sent: Wednesday, August 31, 2011 9:56 AM
To: Len Brown
Cc: Arjan van de Ven; Li, Aubrey; linux acpi
Subject: [RFC]cpuidle: disable menu governor if nohz is disabled

Lenb,
Aubrey is asking me to fix the issue. So either we delete disable nohz code or fix cpuidle. if you want to fix cpuidle, here it is.

Thanks,
SHaohua

Subject: cpuidle: disable menu governor if nohz is disabled

Aubrey is asking why nohz disables C-state. nohz has no dependency with idle, but menu governor does. If nohz is disabled, using menu governor is pointless, because we never get correct sleep length, so let's use ladder governor just like nohz isn't compiled in.

Frankly, disabling nohz is strange, but in case somebody cares, here is the fix.

drivers/cpuidle/governors/menu.c +2 -0
index c47f3d0..cbf9afa 100644
@@ -408,6 +408,8 @@ static struct cpuidle_governor menu_governor = {
  */
 static int __init init_menu(void)
 {
+	if (!tick_nohz_enabled)
+		return 0;
 	return cpuidle_register_governor(&menu_governor);
 }
 
include/linux/tick.h index b232ccc..88895c7 renamed from include/linux/tick.h +0 -0

100644

include/linux/tick.h +0 -0
@@ -126,6 +126,7 @@ extern void tick_nohz_restart_sched_tick(void);
 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); +extern int tick_nohz_enabled;

 # else
 static inline void tick_nohz_stop_sched_tick(int inidle) { }  static inline void
tick_nohz_restart_sched_tick(void) { } diff --git a/kernel/time/tick-sched.c
b/kernel/time/tick-sched.c index d5097c4..6a270fe 100644
kernel/time/tick-sched.c +1 -1
@@ -105,7 +105,7 @@ static ktime_t tick_init_jiffy_update(void)
 /*
  * NO HZ enabled ?
  */
-static int tick_nohz_enabled __read_mostly  = 1;
+int tick_nohz_enabled __read_mostly  = 1;
 
 /*
  * Enable / Disable tickless mode
#2 lore raw
In reply to Shaohua Li
Quoted 7 lines · On Wed, 31 Aug 2011 09:56:07 +0800 Shaohua Li <[email protected]> wrote:

Lenb,
Aubrey is asking me to fix the issue. So either we delete disable nohz code or fix cpuidle. if you want to fix cpuidle, here it is.

Thanks,
SHaohua

Quoted 7 lines

Subject: cpuidle: disable menu governor if nohz is disabled

Aubrey is asking why nohz disables C-state. nohz has no dependency with idle, but menu governor does. If nohz is disabled, using menu governor is pointless, because we never get correct sleep length, so let's use ladder governor just like nohz isn't compiled in.

I would prefer to not allow nohz.......

Signature · 3 lines
Arjan van de Ven 	Intel Open Source Technology Centre
For development, discussion and tips for power savings, 
visit http://www.lesswatts.org
author
#3 lore raw
Quoted 12 lines · Arjan van de Ven
Quoted 9 lines · On Wed, 31 Aug 2011 09:56:07 +0800 Shaohua Li <[email protected]> wrote:

Lenb,
Aubrey is asking me to fix the issue. So either we delete disable nohz code or fix cpuidle. if you want to fix cpuidle, here it is.

Thanks,
SHaohua

Subject: cpuidle: disable menu governor if nohz is disabled

Quoted 8 lines
Quoted 5 lines

Aubrey is asking why nohz disables C-state. nohz has no dependency with idle, but menu governor does. If nohz is disabled, using menu governor is pointless, because we never get correct sleep length, so let's use ladder governor just like nohz isn't compiled in.

I would prefer to not allow nohz.......

is there any risk to do this? maybe lenb can answer why previous attempt to do this failed.