Skip to content

Frequency Scaling

Dynamic frequency scaling (DFS) is a critical technique for balancing CPU performance and power efficiency. By dynamically adjusting CPU clock speeds based on workload, systems can optimize thermal output, extend battery life, and improve responsiveness. This section covers configuring DFS using cpufrequtils, kernel parameters, and BIOS settings to achieve workload-aware power management.


Understanding CPU Governors

Linux uses governors to determine how CPU frequency scales. Common governors include:
- performance: Maximize CPU frequency for performance.
- powersave: Minimize frequency to save power.
- ondemand: Increases frequency when CPU utilization exceeds a threshold.
- conservative: Similar to ondemand, but with slower frequency adjustments.

To list available governors:

cpufreq-info | grep "governor"


Configuring cpufrequtils

The cpufrequtils package provides tools to set governors and frequencies.

Installation (Debian/Ubuntu):

sudo apt install cpufrequtils

Setting a Governor:

sudo cpufreq-set -g performance  # Set to high-performance mode
sudo cpufreq-set -g powersave    # Set to power-saving mode

Adjusting Frequency Limits:

sudo cpufreq-set -u 2.4GHz      # Set upper frequency limit (e.g., 2400000 kHz)
sudo cpufreq-set -l 1.2GHz      # Set lower frequency limit (e.g., 1200000 kHz)

Note: Frequency limits depend on CPU capabilities. Use cpufreq-info to check supported ranges.


Kernel Parameters for Governor Control

Set default governors via kernel command-line parameters. Edit /etc/default/grub:

GRUB_CMDLINE_LINUX="intel_pstate=disable governor=powersave"

Update the bootloader:

sudo update-grub
sudo update-initramfs -u

Tip: For Intel CPUs, intel_pstate=disable ensures compatibility with cpufrequtils. Use acpi_pstate=disable for AMD.


BIOS/UEFI Power Management Settings

Optimize power management at the firmware level:
1. Enable C-states: Allow CPU idle states to reduce power consumption.
2. Adjust Power Profiles: Select "Balanced" or "Power Saving" modes.
3. Disable Unnecessary Features: Turn off Hyper-Threading or Turbo Boost if not needed.

Example BIOS settings:
- Intel: Navigate to "Power Management" and enable "C1E" or "C6" states.
- AMD: Set "Power Now!" to "Enabled" and adjust "Power Profile" to "Power Saving".


Monitoring and Troubleshooting

Use these tools to verify DFS behavior:
- sensors: Check CPU temperature and frequency.
- top/htop: Monitor CPU utilization.
- /sys/class/cpu/: Read frequency scaling details:

cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq

If DFS is not working:
1. Ensure cpufrequtils or kerneloops is installed.
2. Check for conflicting BIOS settings (e.g., disabled C-states).
3. Verify kernel parameters are applied via dmesg or /boot/config-$(uname -r).


Key takeaways

  • Use cpufrequtils to set governors and frequency limits dynamically.
  • Configure kernel parameters to enforce default governors across reboots.
  • Optimize BIOS settings for C-states and power profiles.
  • Monitor CPU utilization and temperature to balance performance and power.
  • Troubleshoot conflicts between kernel, BIOS, and hardware settings.