From: Shaohua Li <shaohua.li@intel.com>
To: Len Brown <lenb@kernel.org>
Cc: Arjan van de Ven <arjan@infradead.org>,
"Li, Aubrey" <aubrey.li@intel.com>,
linux acpi <linux-acpi@vger.kernel.org>
Subject: [RFC]cpuidle: disable menu governor if nohz is disabled
Date: Wed, 31 Aug 2011 09:56:07 +0800 [thread overview]
Message-ID: <1314755767.29510.57.camel@sli10-conroe> (raw)
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.
Reported-by: Aubrey Li <aubrey.li@intel.com>
Signed-off-by: Shaohua Li <shaohua.li@intel.com>
diff --git a/drivers/cpuidle/governors/menu.c b/drivers/cpuidle/governors/menu.c
index c47f3d0..cbf9afa 100644
--- a/drivers/cpuidle/governors/menu.c
+++ b/drivers/cpuidle/governors/menu.c
@@ -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);
}
diff --git a/include/linux/tick.h b/include/linux/tick.h
index b232ccc..88895c7 100644
--- a/include/linux/tick.h
+++ b/include/linux/tick.h
@@ -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
--- a/kernel/time/tick-sched.c
+++ b/kernel/time/tick-sched.c
@@ -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
next reply other threads:[~2011-08-31 1:53 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-08-31 1:56 Shaohua Li [this message]
2011-08-31 2:22 ` [RFC]cpuidle: disable menu governor if nohz is disabled Li, Aubrey
2011-08-31 2:35 ` Arjan van de Ven
2011-08-31 4:50 ` Shaohua Li
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1314755767.29510.57.camel@sli10-conroe \
--to=shaohua.li@intel.com \
--cc=arjan@infradead.org \
--cc=aubrey.li@intel.com \
--cc=lenb@kernel.org \
--cc=linux-acpi@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox