CPU Governors
Linux CPU frequency scaling allows the kernel to dynamically adjust CPU clock speeds to balance performance, power consumption, and thermal management. The CPU governor determines the policy for frequency scaling, influencing how the system responds to workload changes. This section explores the core governors—performance, powersave, and ondemand—and their impact on CPU throttling and thermal behavior.
Performance Governor¶
The performance governor locks the CPU at its maximum frequency, prioritizing performance over power efficiency.
- Behavior:
- Maintains highest possible clock speed regardless of workload.
- No dynamic throttling.
- Use Cases:
- Workloads requiring consistent high performance (e.g., servers, gaming).
- Environments where thermal throttling is mitigated by hardware (e.g., high-end CPUs with robust cooling).
- Impact:
- Maximizes performance but increases power consumption and heat output.
Example:
Powersave Governor¶
The powersave governor keeps the CPU at its minimum frequency, prioritizing energy efficiency.
- Behavior:
- Operates at the lowest clock speed unless the system is under heavy load.
- Throttles CPU when idle to save power.
- Use Cases:
- Battery-powered devices (laptops, tablets).
- Low-activity environments (e.g., servers with minimal traffic).
- Impact:
- Reduces power usage and heat but may introduce latency during sudden workload spikes.
Example:
Ondemand Governor¶
The ondemand governor dynamically adjusts frequency based on CPU utilization.
- Behavior:
- Increases frequency when CPU load exceeds a threshold (default: 80%).
- Returns to minimum frequency when idle.
- Use Cases:
- Desktop systems balancing performance and power.
- Workloads with variable CPU demand (e.g., web servers, development environments).
- Impact:
- Strikes a balance between performance and efficiency but may cause minor latency during transitions.
Example:
Thermal Management and Governor Interaction¶
Governors indirectly influence thermal management by controlling CPU frequency:
- Thermal Throttling: If temperatures exceed thresholds, the kernel may force the CPU to reduce frequency to prevent damage.
- Governor Priorities:
- performance risks overheating if cooling is inadequate.
- powersave and ondemand are safer for thermal-sensitive systems.
- Monitoring: Use thermal_zone0 (or similar sensors) to track temperatures:
Key takeaways¶
- Performance governor maximizes speed at the cost of power/heat.
- Powersave governor prioritizes energy efficiency but may lag under load.
- Ondemand balances performance and power, ideal for most workloads.
- Thermal management depends on governor behavior and hardware cooling.
- Use
cpufreq-infoto check available governors and current settings.