Table of Contents
CPU-frequency scaling with Slackware
CPU frequency scaling is carried out by the kernel. Slackware comes with all requirements necessary to use this feature.
The kernel module which provides cpu frequency scaling for AMD processors is powernow_k8; for Intel, the modules are x86_speedstep_centrino and x86_p4_clockmod.
Slackware comes with the cpufrequtils package which helps to configure frequency scaling in an appropriate manner.
Configuring the kernel
Cpu frequency scaling can be done automatically by a so-called governor, or manually. The governors available are “conservative”, “ondemand”, “powersave” and “performance”. When you build your own kernel, you can choose one of these governors or “userspace” which allows for configuring cpu frequency in userspace. The stock Slackware kernels are configured for “userspace” by default.
Explanation of the governors
The “performance” governer always sets the highest frequency available for the processor. “ondemand” switches dynamically between the available frequencies depending on the system load. “conservative” is similar to “ondemand”, but always tries to use the lowest frequency possible. “powersave” sets the frequency to the lowest possible. When you configure your kernel for “userspace” you can configure the different governors in userspace (which is most convenient).
Checking the cpu frequency settings on your computer
You can check the settings on your system with the command
Or using sysfs:
where “cpu*” per cpu subdir.
The cpufrequtils package provides two commands. With
cpufreq-info you can find out which governor is configured and also some other information, for example, the available frequencies for your processor.
cpufreq-set command can be used to set the appropriate governor.
On my laptop I have the following lines in my
# CPU-frequency scaling cpufreq-set --cpu 0 --governor conservative cpufreq-set --cpu 1 --governor conservative
If using sysfs:
echo "conservative" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor echo "conservative" > /sys/devices/system/cpu/cpu1/cpufreq/scaling_governor
I recommend reading the manpages for cpufreq-info and cpufreq-set. Also you can read the relevant documentation in the kernel sources.
- Originally written by Markus Hutmacher