Speed down your CPU
Outdated content
Published on 2008-08-12.
Getting the CPU to slow down using a lower frequency when not used can save you power and noise. Note, this is automatically setup on laptops on Debian stable aka (currently) Lenny during installation.
To get my P4 2.6 GHz slow down when idle I did the following on Debian.
First check the current frequency with:
# cat /proc/cpuinfo
Next check the current settings with:
# cpufreq-info
If cpufreq-info
isn't installed you can install it by installing the cpufrequtils
package.
# apt-get install cpufrequtils
Next, verify your exact CPU model.
# cat /proc/cpuinfo | grep "model name"
In this case I get the following:
model name : Intel(R) Pentium(R) 4 CPU 2.60GHz
Once you know your exact CPU type, the next step is to load the proper modules: the CPU frequency driver and the CPU frequency policy governor.
The CPU frequency driver will differ depending on your type of CPU:
AMD K6 processors : powernow_k6 AMD K7 processors (Athlon, Duron, Sempron 32 bits) : powernow_k7 AMD K8 processors (Athlon 64, Turion 64, Sempron 64, Opteron 64) : powernow_k8 Pentium 4, Celeron D, Pentium D, Celeron M : p4_clockmod Pentium M, Core Duo, Core 2 Duo : speedstep_centrino
There are of course other CPU frequency drivers. In doubt, you can use the generic driver: acpi_cpufreq
In my case I the need p4_clockmod
module.
Once the proper driver is loaded, you need to choose the desired CPU policy governor. This policy governor will manage the actual behavior of your CPU. Here is some policy governors and their module names:
cpufreq_performance : which sets the CPU statically to the highest possible frequency. cpufreq_powersave : which is the opposite, clocks the CPU statically to the lowest frequency. cpufreq_ondemand : which sets the CPU speed dynamically depending on the work load (ideal for desktops). cpufreq_conservative : which also sets the CPU dynamically, but less aggressively then the ondemand governor (ideal for laptops).
Since this particular machine is my main desktop I am going to use the cpufreq_ondemand
module.
To load both modules I issue this command:
# modprobe cpufreq_ondemand
# modprobe p4_clockmod
Once the modules are loaded, you need to configure the policy governor. I use the ondemand
governor, so I need to set that in /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
.
Use the following command to do that:
# echo ondemand | tee /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
You can validate that everything went well with both:
# cpufreq-info
and
# cat /proc/cpuinfo
My CPU frequency is now dropping from a constant 2.6 GHz unto 325 Mhz and since my CPU fan is using a variable rotation based upon how much heat the CPU generates, my PC not only saves power but also becomes more quiet.
Next, make this configuration permanent. First make sure the proper modules are loaded at startup in /etc/modules
:
# echo p4_clockmod | tee -a /etc/modules
# echo cpufreq_ondemand | tee -a /etc/modules
Last you need to ensure that the CPU uses your policy governor by default. Edit /etc/sysfs.conf
and insert this line:
devices/system/cpu/cpu0/cpufreq/scaling_governor = ondemand
Of course you need to change the ondemand
with something else if that's not what you are using.