Power Management Guide
Power Management Guide
Abstract
This document explains how to manage power consumption on Red Hat Enterprise
Linux 5 systems effectively. The following sections discuss different techniques that
lower power consumption (for both server and laptop), and how each technique
affects the overall performance of your system.
A. Revision History 7
Index 7
1
Power Management Guide
As a rule, lowering the power consumption of a specific component (or of the system as a whole)
will lead to lower heat and naturally, performance. As such, you should thoroughly study and test
the decrease in performance afforded by any configurations you make, especially for mission-critical
systems.
The following sections will explain how optimal hardware performance benefits your system in terms of
energy consumption.
The governor defines the power characteristics of the system CPU, which in turn affects CPU
performance. Each governor has its own unique behavior, purpose, and suitability in terms of
workload. This section describes how to choose and configure a CPUfreq governor, the characteristics
of each governor, and what kind of workload each governor is suitable for.
2
CPUfreq Setup
As a rule, lowering the power consumption of a specific component (or of the system as a whole)
will lead to lower heat and naturally, performance. As such, you should thoroughly study and test
the decrease in performance afforded by any configurations you make, especially for mission-critical
systems.
The following sections explain how optimal hardware performance benefits your system in terms of
energy consumption.
ls /lib/modules/[kernel version]/kernel/arch/[architecture]/kernel/cpu/
cpufreq/
cd /lib/modules/[kernel version]/kernel/arch/[architecture]/kernel/cpu/
cpufreq/
When using the above command, be sure to remove the .ko filename suffix.
Important
When choosing an appropriate CPUfreq driver, always choose acpi-cpufreq
over p4-clockmod. While using the p4-clockmod driver reduces the clock
frequency of a CPU, it does not reduce the voltage. acpi-cpufreq, on the
other hand, reduces voltage along with CPU clock frequency, allowing less power
consumption and heat output for each unit reduction in performance.
4. Once the CPUfreq driver is set up, you can view which governor the system is currently using
with:
cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
3
Power Management Guide
You can also view which governors are available for use for a specific CPU using:
Some CPUfreq governors may not be available for you to use. In this case, use modprobe to add the
necessary kernel modules that enable the specific CPUfreq governor you wish to use. These kernel
modules are available in /lib/modules/[kernel version]/kernel/drivers/cpufreq/.
cd /lib/modules/[kernel version]/kernel/drivers/cpufreq/
2. Use modprobe to enable the governor you wish to use. For example, if the ondemand governor
is not available for your CPU, use the following command:
modprobe cpufreq_ondemand
3. Once a governor is listed as available for your CPU, you can enable it using:
• cpuinfo_min_freq — Shows the CPU's available minimum operating frequency (in KHz).
• cpuinfo_max_freq — Shows the CPU's available maximum operating frequency (in KHz).
• scaling_driver — Shows what CPUfreq driver is used to set the frequency on this CPU.
• scaling_min_freq and scaling_max_freq — Sets the policy limits of the CPU, in KHz.
4
CPUfreq Governor Types
Important
When setting policy limits, you should set scaling_max_freq before
scaling_min_freq.
• scaling_setspeed — Used to change the clock speed of the CPU, in KHz. You can only set a
speed within the policy limits of the CPU (as per scaling_min_freq and scaling_max_freq).
To view the current value of each tunable, use cat [tunable]. For example, to view the current
speed of cpu0 (in KHz), use:
cat /sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_cur_freq.
To change the value of each tunable, use echo [value] > /sys/devices/system/cpu/[cpu
ID]/cpufreq/[tunable]. For example, to set the minimum clock speed of cpu0 to 360 KHz, use:
cpufreq_performance
The Performance governor forces the CPU to use the highest possible clock frequency. This
frequency will be statically set, and will not change. As such, this particular governor offers no power
saving benefit. It is only suitable for hours of heavy workload, and even then only during times wherein
the CPU is rarely (or never) idle.
cpufreq_powersave
By contrast, the Powersave governor forces the CPU to use the lowest possible clock frequency. This
frequency will be statically set, and will not change. As such, this particular governor offers maximum
power savings, but at the cost of the lowest CPU performance.
The term "powersave" can sometimes be decieving, though, since (in principle) a slow CPU on full
load consumes more power than a fast CPU that is not loaded. As such, while it may be advisable to
set the CPU to use the Powersave governor during times of expected low activity, any unexpected
high loads during that time can cause the system to actually consume more power.
The Powersave governor is, in simple terms, more of a "speed limiter" for the CPU than a "power
saver". It is most useful in systems and environments where overheating can be a problem.
cpufreq_ondemand
The Ondemand governor is a dynamic governor that allows the CPU to achieve maximum clock
frequency when system load is high, and also minimum clock frequency when the system is idle.
While this allows the system to adjust power consumption accordingly with respect to system load,
5
Power Management Guide
it does so at the expense of latency between frequency switching. As such, latency can offset any
performance/power saving benefits offered by the Ondemand governor if the system switches
between idle and heavy workloads too often.
For most systems, the Ondemand governor can provide the best compromise between heat emission,
power consumption, performance, and manageability. When the system is only busy at specific
times of the day, the Ondemand governor will automatically switch between maximum and minimum
frequency depending on the load without any further intervention.
cpufreq_userspace
The Userspace governor allows userspace programs (or any process running as root) to set the
frequency. This governor is normally used in conjunction with the cpuspeed daemon. Of all the
governors, Userspace is the most customizable; and depending on how it is configured, it can offer the
best balance between performance and consumption for your system.
cpufreq_conservative
Like the Ondemand governor, the Conservative governor also adjusts the clock frequency according
to usage (like the Ondemand governor). However, while the Ondemand governor does so in a more
aggressive manner (i.e. from maximum to minimum and back), the Conservative governor switches
between frequencies more gradually.
This means that the Conservative governor will adjust to a clock frequency that it deems fitting for the
load, rather than simply choosing between maximum and minimum. While this can possibly provide
significant savings in power consumption, it does so at an ever greater latency than the Ondemand
governor.
Note
You can enable a governor using cron jobs. This allows you to automatically set
specific governors during specific times of the day. As such, you can specify a low-
frequency governor during idle times (e.g. after work hours) and return to a higher-
frequency governor during hours of heavy workload.
Power savings introduced by ALPM come at the expense of disk latency. As such, you should only
use ALPM if you expect the system to experience long periods of idle I/O time.
ALPM is only available on SATA controllers that use the Advanced Host Controller Interface (AHCI).
For more information about AHCI, refer to http://1www.intel.com/1technology/1serialata/1ahci.htm.
6
Revision History
min_power
This mode sets the link to its lowest power state (SLUMBER) when there is no I/O on the disk. This
mode is useful for times when an extended period of idle time is expected.
medium_power
This mode sets the link to the second lowest power state (PARTIAL) when there is no I/O on the disk.
This mode is designed to allow transitions in link power states (e.g. during times of intermittent heavy
I/O and idle I/O) with as small impact on performance as possible.
medium_power mode allows the link to transition between PARTIAL and fully-powered (i.e.
"ACTIVE") states, depending on the load. Note that it is not possible to transition a link directly from
PARTIAL to SLUMBER and back; in this case, either power state cannot transition to the other without
transitioning through the ACTIVE state first.
max_performance
ALPM is disabled; the link does not enter any low-power state when there is no I/O on the disk.
Warning
Setting ALPM to min_power or medium_power will automatically disable the "Hot
Plug" feature.
A. Revision History
Revision History
Revision 1.0 [email protected]
updated to build on Publican 0.36
Index
A
acpi-cpufreq
CPUfreq
setup, 3
adding a driver
CPUfreq
setup, 3
adding a governor
CPUfreq
setup, 4
Advanced Host Controller Interface
Aggressive Link Power Management, 6
affected_cpus
CPUfreq
tuning, 5
Aggressive Link Power Management
7
Power Management Guide
B
basics
power management, 2
principles behind, 2
C
concerns surrounding power management
CPUfreq
governors, 3
Conservative governor
CPUfreq
governor types, 6
CPUfreq, 2, 3, 4
cron, 6
governor types, 5
Conservative governor, 6
cpufreq_conservative, 6
cpufreq_ondemand, 5
cpufreq_performance, 5
cpufreq_powersave, 5
cpufreq_userspace, 6
Ondemand governor, 5
Performance governor, 5
Powersave governor, 5
Userspace governor, 6
governors, 2
concerns surrounding power management, 3
definition, 2
setup, 3
acpi-cpufreq, 3
adding a driver, 3
adding a governor, 4
enabling a governor, 4
modprobe, 4
p4-clockmod, 3
selecting a driver, 3
8
Revision History
tuning, 4
affected_cpus, 5
cpuinfo_cur_freq, 4
cpuinfo_max_freq, 4
cpuinfo_min_freq, 4
policy, 4
policy limits, 5
scaling_available_frequencies, 4
scaling_available_governors, 4
scaling_driver, 4
scaling_governor, 4
scaling_min_freq, 4
scaling_setspeed, 5
types of governors, 5
cpufreq_conservative
CPUfreq
governor types, 6
cpufreq_ondemand
CPUfreq
governor types, 5
cpufreq_performance
CPUfreq
governor types, 5
cpufreq_powersave
CPUfreq
governor types, 5
cpufreq_userspace
CPUfreq
governor types, 6
cpuinfo_cur_freq
CPUfreq
tuning, 4
cpuinfo_max_freq
CPUfreq
tuning, 4
cpuinfo_min_freq
CPUfreq
tuning, 4
cron
CPUfreq, 6
scheduled governor switching, 6
D
definition
CPUfreq
governors, 2
E
enabling a governor
CPUfreq
setup, 4
9
Power Management Guide
G
governor types
CPUfreq, 5
Conservative governor, 6
cpufreq_conservative, 6
cpufreq_ondemand, 5
cpufreq_performance, 5
cpufreq_powersave, 5
cpufreq_userspace, 6
Ondemand governor, 5
Performance governor, 5
Powersave governor, 5
Userspace governor, 6
governors
CPUfreq, 2
concerns surrounding power management, 3
definition, 2
H
hot-plug
Aggressive Link Power Management, 7
I
importance
power management, 1
M
max_performance
Aggressive Link Power Management, 7
medium_power
Aggressive Link Power Management, 7
min_power
Aggressive Link Power Management, 7
modprobe
CPUfreq
setup, 4
O
Ondemand governor
CPUfreq
governor types, 5
P
p4-clockmod
CPUfreq
setup, 3
PARTIAL
Aggressive Link Power Management, 7
Performance governor
CPUfreq
10
Revision History
governor types, 5
policy
CPUfreq
tuning, 4
policy limits
CPUfreq
tuning, 5
power management
basics, 2
importance, 1
Powersave governor
CPUfreq
governor types, 5
principles behind
basics, 2
S
SATA-AHCI
Aggressive Link Power Management, 6
scaling_available_frequencies
CPUfreq
tuning, 4
scaling_available_governors
CPUfreq
tuning, 4
scaling_driver
CPUfreq
tuning, 4
scaling_governor
CPUfreq
tuning, 4
scaling_min_freq
CPUfreq
tuning, 4
scaling_setspeed
CPUfreq
tuning, 5
scheduled governor switching
cron, 6
selecting a driver
CPUfreq
setup, 3
setup
CPUfreq, 3
acpi-cpufreq, 3
adding a driver, 3
adding a governor, 4
enabling a governor, 4
modprobe, 4
p4-clockmod, 3
selecting a driver, 3
11
Power Management Guide
SLUMBER
Aggressive Link Power Management, 7
T
tuning
CPUfreq, 4
affected_cpus, 5
cpuinfo_cur_freq, 4
cpuinfo_max_freq, 4
cpuinfo_min_freq, 4
policy, 4
policy limits, 5
scaling_available_frequencies, 4
scaling_available_governors, 4
scaling_driver, 4
scaling_governor, 4
scaling_min_freq, 4
scaling_setspeed, 5
types of governors
CPUfreq, 5
U
Userspace governor
CPUfreq
governor types, 6
12