Posts Tagged scaling

CPU Frequency Scaling

Posted by on Friday, 22 May, 2009

CPU frequency management is one of the keys to power preservation. Ideal for boxes that sit idle a lot of the time, e.g. that file server out the back.

Results will vary with Desktop/GUI systems, I found the response on Xubuntu too slow to clock up when needed, so I would manually set it to performance when using the system and ondemand if I was going to leave it idle. I guess this could be automated, to switch to ondemand when the system has been idle for a while..

apt-get install cpufrequtils sysfsutils
modprobe p4_clockmod (see links at bottom for other CPU types)
modprobe cpufreq_ondemand
echo ondemand | tee /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor

Verify whats happening:

cpufreq-info

Save config/apply at startup:

echo p4_clockmod | tee -a /etc/modules
echo cpufreq_ondemand | tee -a /etc/modules
echo devices/system/cpu/cpu0/cpufreq/scaling_governor = ondemand | tee -a /etc/sysfs.conf

Reboot and run cpufreq-info again to verify:

cpufrequtils 002: cpufreq-info (C) Dominik Brodowski 2004-2006
Report errors and bugs to linux@brodo.de, please.
analyzing CPU 0:
  driver: p4-clockmod
  CPUs which need to switch frequency at the same time: 0 1
  hardware limits: 350 MHz - 2.80 GHz
  available frequency steps: 350 MHz, 700 MHz, 1.05 GHz, 1.40 GHz, 1.75 GHz, 2.10 GHz, 2.45 GHz, 2.80 GHz
  available cpufreq governors: ondemand, userspace, powersave, conservative, performance
  current policy: frequency should be within 350 MHz and 2.80 GHz.
                  The governor "ondemand" may decide which speed to use
                  within this range.
  current CPU frequency is 350 MHz (asserted by call to hardware).
  analyzing CPU 1:
  driver: p4-clockmod
  CPUs which need to switch frequency at the same time: 0 1
  hardware limits: 350 MHz - 2.80 GHz
  available frequency steps: 350 MHz, 700 MHz, 1.05 GHz, 1.40 GHz, 1.75 GHz, 2.10 GHz, 2.45 GHz, 2.80 GHz
  available cpufreq governors: ondemand, userspace, powersave, conservative, performance
  current policy: frequency should be within 350 MHz and 2.80 GHz.
                  The governor "ondemand" may decide which speed to use
                  within this range.
  current CPU frequency is 350 MHz (asserted by call to hardware).

Debian HOW-TO : CPU power management

How to make use of Dynamic Frequency Scaling


CPU frequency scaling

Posted by on Tuesday, 7 April, 2009

Want to do your bit to help save the world?

No real need to have the CPU in your home Linux box burning away flat out! This will idle the CPU at its lowest supported speed, and adjust the clock rate as needed depending on the load. This example is for an P4 based CPU (in my case a Celeron D 2.8GHz) using p4_clockmod

Some of the other common drivers (or modules) are :

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

Right, down to business (replace p4_clockmod with the driver for your CPU):

apt-get install cpufrequtils sysfsutils
modprobe p4_clockmod
modprobe cpufreq_ondemand
echo ondemand | tee /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor

Verify whats happening:

cpufreq-info

cpufrequtils 002: cpufreq-info (C) Dominik Brodowski 2004-2006
Report errors and bugs to linux@brodo.de, please.
analyzing CPU 0:
driver: p4-clockmod
CPUs which need to switch frequency at the same time: 0
hardware limits: 350 MHz – 2.80 GHz
available frequency steps: 350 MHz, 700 MHz, 1.05 GHz, 1.40 GHz, 1.75 GHz, 2.10 GHz, 2.45 GHz, 2.80 GHz
available cpufreq governors: ondemand, performance
current policy: frequency should be within 350 MHz and 2.80 GHz.
The governor “ondemand” may decide which speed to use
within this range.
current CPU frequency is 350 MHz.

Save config/apply at startup:

echo p4_clockmod | tee -a /etc/modules
echo cpufreq_ondemand | tee -a /etc/modules
echo devices/system/cpu/cpu0/cpufreq/scaling_governor = ondemand | tee -a /etc/sysfs.conf

Reboot and run cpufreq-info again to verify. All done! Last-Modified: 2008-12-11 21:19:35