Disabling CPU Frequency Scaling in Ubuntu

Recently I had to compile atlas in Ubuntu. Atlas does not like it when CPU frequency scaling is running because it screws up its timings. Ordinarily a simple change of the frequency governor (i.e. ‘cpufreq-set -g performance’) takes care of this and makes the processor run full-steam-ahead no matter what it’s doing, but Ubuntu seems to second-guess this and periodically resets the governor back to the ‘ondemand’ one. (In theory turning off powernap should stop this behavior, but for whatever reason it was’t behaving on the system I was using).

As far as I can tell, the file that’s in charge of this is ‘/etc/pm/power.d/cpu_frequency’, which uses the file ‘/var/run/powernap/cpu_governor.default’ to determine which governor it should reset to.

So, to permanently set the cpu frequency governor on Ubuntu (at least until a reboot), you can run ‘cat performance >/var/run/powernap/cpu_governor.default’ as root. This makes it reset the governor to performance periodically, which is enough to let atlas compile at least.