diff options
author | Thomas Renninger <trenn@suse.de> | 2015-10-22 11:17:07 -0400 |
---|---|---|
committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2015-11-01 20:28:59 -0500 |
commit | 19c9fb896f54ade387676f134ce1de9bcd3cd478 (patch) | |
tree | 97ac2ed1338d42516dcb0757a2d872603709b52f /tools | |
parent | 645209472d909071df5af2c42ea623ef011ad3c8 (diff) |
cpupower: Enable disabled Cstates if they are below max latency
cpupower idle-set -D <latency>
currently only disables all C-states that have a higher latency than the
specified <latency>. But if deep sleep states were already disabled and
have a lower latency, they should get enabled again.
For example:
This call:
cpupower idle-set -D 30
disables all C-states with a higher or equal latency than 30.
If one then calls:
cpupower idle-set -D 100
C-states with a latency between 30-99 will get enabled again with this patch
now. It is ensured that only C-states with a latency of 100 and higher are
disabled.
Signed-off-by: Thomas Renninger <trenn@suse.de>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'tools')
-rw-r--r-- | tools/power/cpupower/man/cpupower-idle-set.1 | 4 | ||||
-rw-r--r-- | tools/power/cpupower/utils/cpuidle-set.c | 17 |
2 files changed, 16 insertions, 5 deletions
diff --git a/tools/power/cpupower/man/cpupower-idle-set.1 b/tools/power/cpupower/man/cpupower-idle-set.1 index 3e6799d7a79f..580c4e3ea92a 100644 --- a/tools/power/cpupower/man/cpupower-idle-set.1 +++ b/tools/power/cpupower/man/cpupower-idle-set.1 | |||
@@ -20,7 +20,9 @@ Disable a specific processor sleep state. | |||
20 | Enable a specific processor sleep state. | 20 | Enable a specific processor sleep state. |
21 | .TP | 21 | .TP |
22 | \fB\-D\fR \fB\-\-disable-by-latency\fR <LATENCY> | 22 | \fB\-D\fR \fB\-\-disable-by-latency\fR <LATENCY> |
23 | Disable all idle states with a equal or higher latency than <LATENCY> | 23 | Disable all idle states with a equal or higher latency than <LATENCY>. |
24 | |||
25 | Enable all idle states with a latency lower than <LATENCY>. | ||
24 | .TP | 26 | .TP |
25 | \fB\-E\fR \fB\-\-enable-all\fR | 27 | \fB\-E\fR \fB\-\-enable-all\fR |
26 | Enable all idle states if not enabled already. | 28 | Enable all idle states if not enabled already. |
diff --git a/tools/power/cpupower/utils/cpuidle-set.c b/tools/power/cpupower/utils/cpuidle-set.c index 9a9b7a337d7b..eaea1301e29b 100644 --- a/tools/power/cpupower/utils/cpuidle-set.c +++ b/tools/power/cpupower/utils/cpuidle-set.c | |||
@@ -148,12 +148,21 @@ int cmd_idle_set(int argc, char **argv) | |||
148 | (cpu, idlestate); | 148 | (cpu, idlestate); |
149 | state_latency = sysfs_get_idlestate_latency | 149 | state_latency = sysfs_get_idlestate_latency |
150 | (cpu, idlestate); | 150 | (cpu, idlestate); |
151 | if (disabled == 1 || latency > state_latency) | 151 | if (disabled == 1) { |
152 | if (latency > state_latency){ | ||
153 | ret = sysfs_idlestate_disable | ||
154 | (cpu, idlestate, 0); | ||
155 | if (ret == 0) | ||
156 | printf(_("Idlestate %u enabled on CPU %u\n"), idlestate, cpu); | ||
157 | } | ||
152 | continue; | 158 | continue; |
153 | ret = sysfs_idlestate_disable | 159 | } |
154 | (cpu, idlestate, 1); | 160 | if (latency <= state_latency){ |
155 | if (ret == 0) | 161 | ret = sysfs_idlestate_disable |
162 | (cpu, idlestate, 1); | ||
163 | if (ret == 0) | ||
156 | printf(_("Idlestate %u disabled on CPU %u\n"), idlestate, cpu); | 164 | printf(_("Idlestate %u disabled on CPU %u\n"), idlestate, cpu); |
165 | } | ||
157 | } | 166 | } |
158 | break; | 167 | break; |
159 | case 'E': | 168 | case 'E': |