CPU Power and Performance
This guide explains the CPU power and performance mechanisms in Clear Linux* OS.
Modern x86 CPUs employ a number of features and technologies to balance performance, energy, and thermal efficiencies.
By default, Clear Linux OS prioritizes maximum CPU performance with the philosophy that the faster the program finishes execution, the faster the CPU can return to a low energy idle state. It is important to understand and evaluate all of these technologies when troubleshooting or considering changing the defaults.
C-states and P-states are both CPU power saving mechanisms that are entered under different operating conditions. The tradeoff is a slightly longer time to exit these states when the CPU is needed once again.
C-states (idle states)
C-states are hardware sleep states that are entered when it is determined that the CPU is idle and not executing instructions.
C-states aim to reduce power utilization by increasingly reducing clock frequency, voltages, and features in each state.
Although C-states can typically be limited or disabled in a system’s UEFI or BIOS configuration, these settings are overridden when the intel_idle driver is in use.
To view the current cpuidle driver run this command in a terminal:
For troubleshooting, C-states can be limited with a kernel command line boot parameter by adding processor.max_cstate=N intel_idle.max_cstate=N or completely disabled with idle=poll.
- processor.max_cstate=0 is changed to processor.max_cstate=1 by the kernel to be a valid value.
- intel_idle.max_cstate=0 disables the Intel Idle driver, not set it to C-state 0.
P-states (performance states)
P-states, also known as Intel SpeedStep® technology on Intel processors or Cool’n’Quiet on AMD processors, are states entered while the CPU is active and executing instructions.
P-states aim to reduce power utilization by adjusting CPU clock frequency and voltages based on CPU demand.
P-states can typically be limited or disabled in a system’s firmware (UEFI/BIOS).
Intel® Turbo Boost Technology, found on some modern Intel CPUs, allows core(s) on a processor to temporarily operate at a higher than rated CPU clock frequency to accommodate demanding workloads if the CPU is under defined power and thermal thresholds.
Turbo boost is an extension of P-states. As such, changing or limiting C-states or P-states impact the ability of a process to enter Turbo boost.
Turbo boost can be disabled in a system’s UEFI or BIOS. Turbo boost can also be disabled within Clear Linux OS with the command:
echo 1 | sudo tee /sys/devices/system/cpu/intel_pstate/no_turbo
Linux uses the Intel P-state driver, intel_pstate, for modern Intel processors from the Sandy Bridge generation or newer. Other processors may default to the acpi-cpufreq* driver which reads values from the systems UEFI or BIOS.
To view the current CPU frequency scaling driver run this command in a terminal:
Clear Linux OS sets the CPU governor to performance which calls for the CPU to operate at maximum clock frequency. In other words, P-state P0. While this may sound wasteful at first, it is important to remember that power utilization does not increase significantly simply because of a locked clock frequency without a workload.
To view the current CPU frequency scaling governor run this command in a terminal:
To change the CPU frequency scaling governor:
Disable Clear Linux OS enforcement of certain power and performance settings:
sudo systemctl mask clr-power.timer
Change the governor. In the example below, the governor is set to performance:
echo performance | sudo tee /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor
The list of all governors can be found in the Linux kernel documentation on CPUFreq Governors.
The intel_pstate driver only supports performance and powersave governors.
thermald is a Linux thermal management daemon used to prevent the overheating of platforms. When temperature thresholds are exceeded, thermald forces a C-state by inserting CPU sleep cycles and adjusts available cooling methods. This can be especially desirable for laptops.
By default, thermald is disabled in Clear Linux OS and starts automatically if battery power is detected. thermald can be manually enabled using the systemd service by running the command:
sudo systemctl enable --now thermald
For more information, see the thermald man page:
ThermalMonitor is a GUI application that can visually graph and log temperatures from thermald. To use ThermalMonitor, add the desktop-apps-extras bundle and add your user account to the power group:
sudo swupd bundle-add desktop-apps-extras sudo usermod -a -G power <USER> ThermalMonitor
After adding a new group, you must log out and log back in for the new group to take effect.