4.4. CPU Frequency Governors
The frequency of a CPU affects both performance and power usage. The
cpufreq
governors determine the frequency of a CPU at any given time based on a set of rules about the kind of behavior that prompts a change to a higher or lower frequency.
Red Hat recommends the
cpufreq_ondemand
governor for most situations, as this governor provides better performance through a higher CPU frequency when the system is under load, and power savings through a lower CPU frequency when the system is not being heavily used.
Note
When calculating CPU load, the 'ondemand' CPU governor takes into account the
sysfs
parameter io_is_busy
. If this is set to 1
, Input/Output (I/O) activity is included in CPU activity calculations, and if set to 0
it is excluded. The default setting is 1
. If I/O activity is excluded, the ondemand
governor may reduce the CPU frequency to reduce power usage, resulting in slower I/O operations.
The full path for the
io_is_busy
parameter is /sys/devices/system/cpu/cpufreq/ondemand/io_is_busy
.
For maximum performance at the expense of power savings, you can use the
cpufreq_performance
governor. This governor uses the highest possible CPU frequency to ensure that tasks execute as quickly as possible. This governor does not make use of power saving mechanisms such as sleep or idle, and is therefore not recommended for data centers or similar large deployments.
Procedure 4.1. Enabling and configuring a governor
- Ensure that cpupowerutils is installed:
# yum install cpupowerutils
- Check that the driver you want to use is available.
# cpupower frequency-info --governors
- If the driver you want is not available, use the
modprobe
command to add it to your system. For example, to add theondemand
governor, run:# modprobe cpufreq_ondemand
- Set the governor temporarily by using the cpupower command line tool. For example, to set the
ondemand
governor, run:# cpupower frequency-set --governor ondemand
The profiles that ship with the tuned-adm tool also make use of CPU frequency governors; for details, see Section 3.6, “Tuned and ktune”.