Table of Contents

cpufreq

sys interface

ls -l /sys/devices/system/cpu/cpu0/cpufreq/
-r--r--r-- 1 root root 4096 lis 14 12:18 affected_cpus             0
-r--r--r-- 1 root root 4096 lis 14 13:08 bios_limit                3400000
-rw-r--r-- 1 root root 4096 lis 14 13:08 cpb
-r-------- 1 root root 4096 lis 14 12:46 cpuinfo_cur_freq
-r--r--r-- 1 root root 4096 lis 14 12:18 cpuinfo_max_freq
-r--r--r-- 1 root root 4096 lis 14 12:18 cpuinfo_min_freq
-r--r--r-- 1 root root 4096 lis 14 12:46 cpuinfo_transition_latency
-r--r--r-- 1 root root 4096 lis 14 13:08 freqdomain_cpus
-r--r--r-- 1 root root 4096 lis 14 12:46 related_cpus
-r--r--r-- 1 root root 4096 lis 14 12:18 scaling_available_frequencies
-r--r--r-- 1 root root 4096 lis 14 12:18 scaling_available_governors
-r--r--r-- 1 root root 4096 lis 14 12:46 scaling_cur_freq          1400000
-r--r--r-- 1 root root 4096 lis 14 12:46 scaling_driver            acpi-cpufreq
-rw-r--r-- 1 root root 4096 lis 14 12:19 scaling_governor          userspace
-rw-r--r-- 1 root root 4096 lis 14 12:47 scaling_max_freq
-rw-r--r-- 1 root root 4096 lis 14 12:47 scaling_min_freq
-rw-r--r-- 1 root root 4096 lis 14 13:08 scaling_setspeed
drwxr-xr-x 2 root root    0 lis 14 12:20 stats

List current governors:

cat /sys/devices/system/cpu/cpu?/cpufreq/scaling_governor
cpufreqd.service                                                                                      loaded active running   LSB: start and stop cpufreqd
cpufrequtils.service                                                                                  loaded active exited    LSB: set CPUFreq kernel parameters
loadcpufreq.service                                                                                   loaded active exited    LSB: Load kernel modules needed to enable cpufreq scaling
/etc/init.d/cpufreqd
/etc/init.d/cpufrequtils
/etc/init.d/loadcpufreq

cpufreqd

Fully configurable daemon for dynamic frequency and voltage scaling

/etc/cpufreqd.conf
/etc/default/cpufreqd

cpufrequtils

It provides:

utilities to deal with the cpufreq Linux kernel feature This package contains two utilities for inspecting and setting the CPU frequency through both the sysfs and procfs CPUFreq kernel interfaces. . By default, it also enables CPUFreq at boot time if the correct CPU driver is found.

/etc/default/cpufrequtils

change governor for all cpus

for ((i=0;i<$(nproc);i++)); do cpufreq-set -c $i -r -g powersave; done

Ansible one liner:

(cd .. && ansible pves -i $INVENTORY -a "bash -c 'for ((i=0;i<\$(nproc);i++)); do cpufreq-set -c \$i -r -g powersave; done'" --become)