Sunday, May 17, 2009

Ubuntu CPU Scaling Annoyance

I have a dual boot Windows XP/Ubuntu 9.04 thing going on. I mostly sit in windows, for a variety of reasons I won't get into, but every so often will drop into Ubuntu. I started this in school where all of our assignments were compiled and run on linux and so it was just safer (and easier) for me to use linux when working from home.

Now, Ubuntu has a nice CPU scaler, allowing you to set your CPU to different speeds to save power and such. The only problem for me is that whenever I reboot into Windows, whatever the CPU was scaled to at Ubuntu shutdown sticks. I sometimes boot into Windows and fine myself with only a 1 Ghz processor because I forgot to crank it up before shutdown. The is made worse by the fact that "Ondemand" appears to be default scale setting.

So, I decided to try and change the default. A tad annoying since most references I found were to changing the gconf "apps->gnome-power-manager->cpufreq" setting, a setting which apparently no longer exists. So I spent a fair bit of time on this problem, getting a little annoyed. Surely someone else dual boots and has this happen? I eventually hit upon someone who wrote a script he ran at startup to change it:

echo performance > /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor
I was about ready to do this, even though I thought it was ridiculous that I had to, until I decided that something had to be setting it to ondemand at startup and scanned through the files in "/etc/init.d". Sure enough I find one call "ondemand" which contained this:
for CPUFREQ in /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor
do
[ -f $CPUFREQ ] || continue
echo -n ondemand > $CPUFREQ
done
Finally! Getting rid of this file fixed the problem. So, if any one else is as stuck and confused as I was, there it is.

1 comment:

  1. I'm guessing this could also have been fixed by installing chipset drivers for your motherboard in Windows. For some reason these seem to not ever be shipped with Windows proper and always need to be installed yourself.

    ReplyDelete