jump to navigation

CPU frequency scaling in Linux June 22, 2008

Posted by idebian in Debian, GNU/Linux, Hardware.

The recent CPUs have a feature which let them scale their operating frequency (changing a voltage power supply input) according to the system/user needs.
This way, when the entire processor resources are not needed, the system can greatly reduces the overall power consumption, lowering temperatures and fan speed 😉

This post addresses the frequency scaling setup in Linux: enjoy 😀


The overall system that support dynamic frequency scaling in Linux is represented below:

Linux cpufreq architecture

The architecture’s elements are (from the HW to the SW levels):

  • A CPU with frequency scaling support (of course):
  • A CPU-specific driver:
    • acpi_cpufreq: all the ACPI aware (Intel Core2 Duo, AthlonX2, …)
    • powernow_k8: all the AMD K8 (Athlon64, Opteron64, …)
    • longhaul: VIA C3, C7, Nano
  • cpufreq module provides a common interface to the various low level, CPU-specific frequency-control technologies and high-level CPU frequency-controlling policies.
  • kernel governors change the CPU frequency based on different criteria such as CPU usage:
    • Performance keeps the CPU at the highest possible frequency
    • Powersave keeps the CPU at the lowest possible frequency
    • Userspace exports the available frequency information to the user level (through the /sys file system) and permits user-space control of the CPU frequency
    • Ondemand scales the CPU frequencies according to the CPU usage (like does the userspace frequency scaling daemons, but in kernel)
    • Conservative acts like the ondemand but increases frequency step by step
  • User space demons adapt the frequency policy to different situations:
    • powernowd: easy and complete
    • cpufreqd: sophisticated but somewhat complicated to setup

Debian implementation

in Debian all of the above kernel options are compiled as modules out of the box. What we are required to do is simply load the appropriate kernel module to get SpeedStep/Cool’n’Quiet functionality.

ACPI CPU module

Let’s start loading the CPU specific driver, which in my case is acpi-cpufreq:

$ sudo modprobe acpi-cpufreq

Now verify with through the sys interface the processor capabilities:

$ more /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_frequencies
3066000 2933000 2667000 2400000 2133000 1867000 1600000 800000
$ more /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_governors

The performance governor is the default one; we are going to add others soon.

The actual CPU frequency is also reported in the /proc/cpunifo:

$ more /proc/cpuinfo | grep MHz
cpu MHz : 3066.000
cpu MHz : 3066.000

Kernel governor

Since we are going to use the ondemand governor we need to load the corresponding module:

$ sudo modprobe cpufreq_ondemand

The new governor is now listed in the available governors:

$ more /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_governors
ondemand performance

Setting the actual governor is as easy as type (we will automagically configure it later on):

# echo ondemand > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor

verify that it went through:

$ more /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
$ more /proc/cpuinfo | grep MHz
cpu MHz : 800.000
cpu MHz : 800.000

Congratulations!!! We’ve just set the Scaling Frequency system and governor.
We just need to make such behavior permanent (surviving a reboot).

Alternatives: a userspace governor

According to me kernel governors represent a better solution not only in terms of speed but because they can use other information available in the kernel, like scheduler, interrupt load, etc.

Despite that, someone could opt for a userspace governor: in this case Debian offers an off-the-shelf solution which is powernowd.
Simply install powernowd package and eventually tweak its configuration file in /etc/default/powernowd.


In order to automatically load the needed modules we just add them to the /etc/modules file:

# echo "cpu_driver" >> /etc/modules
# echo "governor" >> /etc/modules

Which in my case are:

# echo acpi_cpufreq >> /etc/modules
# echo cpufreq_ondemand >> /etc/modules

The governor set in sysfs can be loaded using the sysfsutils package which is exactly targeted at this aim: it loads at boot-time a sysfs preset stored in the file /etc/sysfs.conf.
Let’s modify the /etc/sysfs.conf to include a line:

devices/system/cpu/cpu0/cpufreq/scaling_governor = ondemand

Reboot and enjoy 😉


In case you like those junky stuff like applets and screenlets (I do like them) there are plenty of such graphical fontends to the cpufreq system.
This is for example GNOME CPU Frequency Scaling Monitor applet.

Gnome CPU Frequency Scaling Monitor applet


  1. How to make use of Dynamic Frequency Scaling
  2. Enhanced Intel SpeedStep® Technology and Demand-Based Switching on Linux


1. E@zyVG - June 23, 2008

Excellent explanation and howto. I see this blog is going to be Debian related only.

2. idebian - June 23, 2008

I wish to keep the blog as general as possible but anyway there will be a strong Debian influence 🙂

3. Ramesh | The Geek Stuff - June 23, 2008


Excellent article on CPU Frequency. I really enjoyed reading it.

The Geek Stuff

4. Paul Siu - June 24, 2008

Thanks, this is the first article I have seem about the user governor. I was wondering what that was for!

5. Cialisst - July 17, 2008

Thx for article

6. Cialis Generico - August 5, 2008

Useful post. good luck.

7. Lonney - December 5, 2008

Hey, thanks for the guide, works on Intel Celeron D processors too, clocked mine from 2.8GHz down to 350MHz. Ideal for that home Linux box that sits idle most of the time!



still reports: ondemand performance, after the changes, have double checked this.

And missing is /etc/sysfs.conf, I have Debian Etch installed.

But it appears to have worked:

$ more /proc/cpuinfo | grep MHz
cpu MHz : 349.991

8. boblee - June 5, 2009

Great Blogging!!
Keep Your Good Work Going!!


9. .dhy - June 15, 2009

nice post! thanks!

10. Wawrzek - September 8, 2009

Nice article, but what to do when:

root@berlin:/lib/modules# sudo modprobe acpi-cpufreq

FATAL: Module acpi_cpufreq not found.

root@berlin:/lib/modules# lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 9.04
Release: 9.04
Codename: jaunty

Machine – ThinkPad T21

11. Johan - January 7, 2010

Thank you so much for this article. Just got my T400 but couldn’t get my cpu scaling to work, and then I saw this and it works beautifully!

Keep it up

12. Gnome CPU Frequency Scaling Monitor Authorization Policy - Colin Harrington - March 28, 2010

[…] which governs how the CPU is utilized from a power/performance perspective (see CPU Frequency Scaling in Linux for more). […]

13. Francisco Treviño - May 22, 2010

ondemand is on the governors available, however after doing
echo ondemand > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
the governor returns to ‘performance’
there’s no ‘cpufreq_ondemand’ as result of lsmod, I think that could be the problem, however I can’t find a way to load that module. Thanks!

14. Manish GUpta - January 8, 2011

Can we change cpu frequency independent of voltage. Say scaling the frequency but the voltage remain at fixed value.

System may fail to operate but i wish to know if it is possible by some hack in cpufreq?

15. eric javits handbags - January 16, 2011

Wow!!That’s what I’ve benn looking for for a long time~!!
Thanks for sharing this post~~.

16. The Answer Lies Elsewhere - DevGuli - July 3, 2011

[…] I was searching for the technique to better monitor CPU usage, I stumbled across a blog post about CPU frequency scaling. I read it and learned that some processors were able to lower its frequency to save power and […]

17. Governor - Forum Android Italiano - November 26, 2011

[…] […]

18. VInny - July 20, 2012

Does ARM doesnt support Cpu freq scaling

19. cnwtx - September 9, 2012

Yikes! I just did this and it deleted all the contents of my /sys directory. . . ? It looks like I’ll be starting over from scratch. . .

20. Samsung Silent Mode imitieren - Linux: Linux-Forum - July 12, 2013

[…] https://idebian.wordpress.com/2008/06…ling-in-linux/ […]

21. http://Www.Videomobilnik.ru/index.php?do=/blog/155/erotic-http-www-codexsr-com-userprofile-tabid-86-userid-110435-default-aspx/add-comment/ - August 15, 2014

What’s Happening i’m new to this, I stumbled upon this I have discovered
It absolutely useful and it has helped me out loads.

I am hoping to contribute & aid other users like its
helped me. Good job.

22. Ewald van Geffen - November 17, 2014

For reference: works on vyos, vyatta and ubuntu as well. It’s ‘the old way’ of doing things since we now can use userland tools such as cpupower.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: