CPU frequency scaling
CPU frequency scaling is a technique whereby the frequency of a processor can be automatically adjusted "on the fly" to conserve power and to reduce the amount of heat generated by the chip.
Some functions can be enabled or disabled in the BIOS. Check that the following, if available, are enabled:
- "Processor C1E support"
- "Enhanced Intel SpeedStep (EIST)"
- "AMD Cool'n'Quiet (C&Q)"
- "AMD PowerNow!"
Activate the following kernel options:
Power management and ACPI options ---> [*] ACPI (Advanced Configuration and Power Interface) Support ---> <*> Processor CPU Frequency scaling ---> -*- CPU Frequency scaling [*] CPU frequency transition statistics Default CPUFreq governor (ondemand) ---> Select a default governor; see below table Default is ondemand *** CPU frequency scaling drivers *** Select a driver; see below table
A CPUFreq governor is needed, which is responsible for choosing the target frequency based on its profile:
|'performance' governor||cpufreq_performance||Sets the frequency statically to the highest available CPU frequency.||For Intel core processors, this should be selected as default.  |
|'powersave' governor||cpufreq_powersave||Sets the frequency statically to the lowest available CPU frequency.||Can't be set as default.|
|'userspace' governor for userspace frequency scaling||cpufreq_userspace||To set the CPU frequency manually or when a userspace program shall be able to set the CPU dynamically.|
|'ondemand' cpufreq policy governor||cpufreq_ondemand||Does a periodic polling and immediately changes frequency based on the CPU utilization.||For processors other than Intel core, this should be selected as default.|
|'conservative' cpufreq governor||cpufreq_conservative||Similar to ondemand. The frequency is gracefully increased and decreased rather than jumping to 100% when speed is required.|
|'schedutil' cpufreq policy governor||cpufreq_schedutil||Aimed at driving the frequency changes by kernel scheduler|
Name of the active CPUFreq governor is available in: /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor
|Intel P state control||intel_pstate||Newer (Sandy Bridge+) Intel Core||Recommended for Sandy Bridge and newer Intel Core/Xeon processors|
|Intel P state control||intel_pstate||Newer (Sandy Bridge+) Intel Core||'intel_cpufreq' mode of the 'intel_pstate' driver enabled for Intel Core/Xeon processors lacking HWP (|
|ACPI Processor P-States driver||acpi-cpufreq||AMD EPYC/Ryzen, older Intel Core (pre-Sandy Bridge)/Xeon, AMD Opteron/Phenom, Intel Atom, Intel Pentium M||Acts as a generic CPUFreq driver|
|AMD Opteron/Athlon64 PowerNow!||powernow-k8||AMD Opteron/Athlon 64, AMD Turion 64||Supports older AMD K8-based processors|
|Intel Enhanced SpeedStep (deprecated)||speedstep-centrino||Intel Pentium M (Centrino)/Xeon||Deprecated, use ACPI Processor P-States driver instead|
|Intel Pentium 4 clock modulation||p4-clockmod||Intel Pentium 4/Xeon||Causes severe slowdowns and noticeable latency|
|Processor Clocking Control interface driver||pcc-cpufreq|
Name of the active CPUFreq driver is available in: /sys/devices/system/cpu/cpu*/cpufreq/scaling_driver
The processor saves the most energy when the processor stays longer in power savings mode, so reduce the amount of ticks that wakes the processor up. Details about the available tickless modes can be found in the kernel documentation.
Some functions can be enabled or disabled in the BIOS. Check that the following are enabled:
- "Multimedia timer"
Activate the following kernel options for power saving features:
General setup ---> Timers subsystem ---> [*] Idle dynticks system (tickless idle) [*] High Resolution Timer Support Device Drivers ---> Character devices ---> [*] HPET Timer Support
PowerTOP is a utility designed to measure, explain and minimize a computer's electrical power consumption.
When it is run, it sorts the running processes in order of how often they cause the processor to wake up. For details on installation, configuration and usage see the separate PowerTOP article.
Manual governor change
It is possible to change the active CPU governor using a simple command:
echo ondemand | tee /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor
Read /etc/local.d/README to learn how to execute this command on startup.
Applications such as sys-power/cpupower do little more than the above but with some interface on top of it. However, having to run certain commands as root depending on the system usage is not efficient for most users. It is better to automate some of the decisions of governing CPU frequency. For instance, when not wired to AC power, most users would like to have the system in a power saving mode.
This is where Hprofile comes into play. Please refer to its article for more information and configuration.
- What exactly is a P-state? (Pt. 1) - An Intel article (kind of) explaining P-states.
- Linux's "Ondemand" Governor Is No Longer Fit - Explains why ondemand should not be used for newer Intel core processors.
- Dominik Brodowski. Intel P-State driver, CPU frequency and voltage scaling code in the Linux(TM) kernel. Retrieved 12 June 2016.
- Michael Larabel. Linux's "Ondemand" Governor Is No Longer Fit. Retrieved 15 October 2016.
- Improvements in CPU frequency management, LWN.net, Neil Brown, 6 April 2016. Retrieved 12 January 2022.
- intel_pstate CPU Performance Scaling Driver, kernel.org, Rafael J. Wysocki. Retrieved 12 January 2022.