linux-pm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFC PATCH] cpuidle: Make cpuidle governor switchable to be the default behaviour
@ 2020-04-27 10:17 Hanjun Guo
  2020-04-27 13:36 ` Daniel Lezcano
  0 siblings, 1 reply; 7+ messages in thread
From: Hanjun Guo @ 2020-04-27 10:17 UTC (permalink / raw)
  To: Rafael J. Wysocki, Daniel Lezcano; +Cc: linux-pm, Hanjun Guo

For now cpuidle governor can be switched via sysfs only when the
boot option "cpuidle_sysfs_switch" is passed, but it's important
to switch the governor to adapt to different workloads, especially
after TEO and haltpoll governor were introduced.

Introduce a CONFIG option to make cpuidle governor switchable to be
the default behaviour, which will not break the boot option behaviour.

Signed-off-by: Hanjun Guo <guohanjun@huawei.com>
---
 drivers/cpuidle/Kconfig | 9 +++++++++
 drivers/cpuidle/sysfs.c | 2 +-
 2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/drivers/cpuidle/Kconfig b/drivers/cpuidle/Kconfig
index c0aeedd..c40cb40 100644
--- a/drivers/cpuidle/Kconfig
+++ b/drivers/cpuidle/Kconfig
@@ -47,6 +47,15 @@ config CPU_IDLE_GOV_HALTPOLL
 config DT_IDLE_STATES
 	bool
 
+config CPU_IDLE_SWITCH_GOV_IN_DEFAULT
+	bool "Switch the CPU idle governor via sysfs at runtime in default behaviour"
+	help
+	  Make the CPU idle governor switchable at runtime, and make it as the
+	  default behaviour even the boot option "cpuidle_sysfs_switch" is not
+	  passed in cmdline.
+
+	  Say N if you unsure about this.
+
 menu "ARM CPU Idle Drivers"
 depends on ARM || ARM64
 source "drivers/cpuidle/Kconfig.arm"
diff --git a/drivers/cpuidle/sysfs.c b/drivers/cpuidle/sysfs.c
index d3ef1d7..43701da 100644
--- a/drivers/cpuidle/sysfs.c
+++ b/drivers/cpuidle/sysfs.c
@@ -146,7 +146,7 @@ static DEVICE_ATTR(current_governor, 0644, show_current_governor,
  */
 int cpuidle_add_interface(struct device *dev)
 {
-	if (sysfs_switch)
+	if (IS_ENABLED(CONFIG_CPU_IDLE_SWITCH_GOV_IN_DEFAULT) || sysfs_switch)
 		cpuidle_attr_group.attrs = cpuidle_switch_attrs;
 
 	return sysfs_create_group(&dev->kobj, &cpuidle_attr_group);
-- 
1.7.12.4


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

end of thread, other threads:[~2020-04-30  7:14 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-04-27 10:17 [RFC PATCH] cpuidle: Make cpuidle governor switchable to be the default behaviour Hanjun Guo
2020-04-27 13:36 ` Daniel Lezcano
2020-04-27 14:41   ` Doug Smythies
2020-04-28  2:47     ` Hanjun Guo
2020-04-29 10:46       ` Rafael J. Wysocki
2020-04-30  7:14         ` Hanjun Guo
2020-04-28  2:42   ` Hanjun Guo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).