Making ‘ondemand’ CPU frequency scaling more responsive
For a while now I’ve found that ondemand CPU frequency scaling (enabled by default) makes my laptop seem sluggish under Ubuntu.
Basically the CPU speed doesn’t seem to increase quickly enough to keep up with the sudden brief bursts of demand caused when using Gmail, or playing Youtube videos for instance. Applying information found on this website seems to give a more responsive system.
echo 1 > /sys/devices/system/cpu/cpu0/cpufreq/ondemand/ignore_nice_load
echo 40 > /sys/devices/system/cpu/cpu0/cpufreq/ondemand/up_threshold
This changes the default behaviour of the ondemand governor to force it to take into account background processes, and tells it to increase CPU speed when your CPU usage exceeds 40% rather than 95% (as is default).
Because /sys/ is a virtual file system created each time you boot your system, any changes you make are lost after a restart. Add the lines above to /etc/rc.local (read here for more on rc.local) to have your chosen settings applied each time you start Ubuntu.
Have fun.
This entry was posted on Tuesday, May 12th, 2009 at 10:28 pm and is filed under Tags: hardware, ubuntu. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.
Post to del.icio.us
Post to Slashdot
Digg this
May 15th, 2009 at 8:24 pm
thx for the hint, this new behaviour annoyed the crap out of me too.
two comments though:
can just c&p it into a file. but that’s just a remark, no critizism here.
would be nice if you give the commands in “code box” or something as script, so a reader (me
when i tried the commands on my system it responded with “/sys/devices/system/cpu/cpu0/cpufreq/ondemand/ignore_nice: No such file or directory”. the file is called ignore_nice_load on my system, i am using ubuntu jaunty, maybe you have cut some text of your command? doesn’t seem obvious to me why the filename should differ on systems.
May 15th, 2009 at 10:04 pm
Ah, it seems I missed ‘_load’ from the end of that file. I’ve edited the tutorial above to reflect that now! I’ve also put the commands in a code box and added some info on how to force these settings to apply at each boot.
May 15th, 2009 at 10:24 pm
awesome
would be nice to have it somewhere in your home-directory AND have it executed by default, in terms of keeping the setting for an upgrade/reinstallation. but i guess a script in ~/ does it aswell.
June 29th, 2009 at 11:47 am
Great little article. Have tried it myself but get “denied” messages when trying this on 9.04. Even running as sudo didn’t help. Finally I tried sudo su, then ran the commands and it works! woo!
I have added the lines into /etc/rc.local but it does not seem to kick in on boot (presumably because of permissions). Any suggestions how I might get this working on each boot?
Thanks again.
June 29th, 2009 at 6:39 pm
Hi Slate8,
Check out this blog post to read how to set a script to run at boot time. http://embraceubuntu.com/2005/09/07/adding-a-startup-script-to-be-run-at-bootup/
Chris
August 21st, 2009 at 8:27 pm
[...] Fuente: Making ‘ondemand’ CPU frequency scaling more responsive [...]