Skip to content

Commit b52e93e

Browse files
guohanjunrafaeljw
authored andcommitted
cpuidle: Make cpuidle governor switchable to be the default behaviour
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. Add available_governors and current_governor into the default attributes, but reserve the current_governor_ro for compatiblity. Signed-off-by: Hanjun Guo <[email protected]> Reviewed-by: Doug Smythies <[email protected]> Tested-by: Doug Smythies <[email protected]> Acked-by: Daniel Lezcano <[email protected]> Signed-off-by: Rafael J. Wysocki <[email protected]>
1 parent ef7e7d6 commit b52e93e

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

drivers/cpuidle/sysfs.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -106,19 +106,20 @@ static ssize_t store_current_governor(struct device *dev,
106106
return ret ? ret : count;
107107
}
108108

109+
static DEVICE_ATTR(available_governors, 0444, show_available_governors, NULL);
109110
static DEVICE_ATTR(current_driver, 0444, show_current_driver, NULL);
111+
static DEVICE_ATTR(current_governor, 0644, show_current_governor,
112+
store_current_governor);
110113
static DEVICE_ATTR(current_governor_ro, 0444, show_current_governor, NULL);
111114

112115
static struct attribute *cpuidle_default_attrs[] = {
116+
&dev_attr_available_governors.attr,
113117
&dev_attr_current_driver.attr,
118+
&dev_attr_current_governor.attr,
114119
&dev_attr_current_governor_ro.attr,
115120
NULL
116121
};
117122

118-
static DEVICE_ATTR(available_governors, 0444, show_available_governors, NULL);
119-
static DEVICE_ATTR(current_governor, 0644, show_current_governor,
120-
store_current_governor);
121-
122123
static struct attribute *cpuidle_switch_attrs[] = {
123124
&dev_attr_available_governors.attr,
124125
&dev_attr_current_driver.attr,

0 commit comments

Comments
 (0)