I like to disable 'TurboBoost' and set the maximum CPU speed to a lower value. That means that ongoing calculations would take some more time, but on the other hand the computer runs quiter and has a better battery life, and maybe even more calculations per battery charge.
I tried something like echo 2000000 >/sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq as root for every CPU core. However, this setup is lost if I restart the system, and even on every standby cycle.
Where to put this commands to make the change permanent? How can I enable an unprevileged user to invoke this command and adjust the frequency on his demand?
22 Answers
TurboBoos can be disabled only in BIOS settings, if you have no such option there you can't disble TurboBoost short of customizing BIOS ROM.
To update value in such files from console use echo -n 100 > /proc/filename. Values are not generally stored anywhere.
To allow non-root to do it, create a script that modifies values, and use visudo to allow access to script.
I've found there is a tool set named 'TLP' () that beside a vast collection of other power saving settings is able to set the maximal CPU frequency for AC and battery use on the users preference. It is no clean solution to the question because it does many more things, but most of them are useful too...
After installation, one can modify the configuration at /etc/default/tlp. There are two entries for that: CPU_SCALING_MAX_FREQ_ON_AC and CPU_SCALING_MAX_FREQ_ON_BAT. The values given there will be used by the TLP scripts to set the CPU frequency limits depending on if a battery is used or not, and it will restore the values after suspend and standby too. Changes to the config can be activated immediately using sudo tlp start.