Assuming your governor is the intel_pstate (default for Intel Sandy Bridge and Ivy Bridge CPUs as of kernel 3.9). This issue is not specific to Arch, but all distros using the new Intel pstate driver for managing CPU frequency/power management. Arch linux CPU frequency scaling.
Theodore Ts'o wrote his explanation on Google+:
- intel_pstate can be disabled at boot-time with kernel arg
intel_pstate=disable
- The problem with the ondemand governor is that it doesn't know the specific capabilities of the CPU
- Executing some tasks with higher frequency will consume less power than would a lower frequency taking more time e.g. arithmetic stuff, but not true for all tasks e.g. loading something from memory
- The intel_pstate driver knows the details of the how the CPU works and it does a better job than the generic ACPI solution
- intel_pstate offers only two governors,
powersave
and performance
. Intel claims that the intel_pstate "powersave" is faster than the generic acpi governor with "performance"
To change back to the ACPI driver, reboot and set the kernel arg intel_pstate=disable
Then execute modprobe acpi-cpufreq
and you should have the ondemand governor available.
You can make the changes permanent by editing /etc/default/grub
and adding
GRUB_CMDLINE_LINUX_DEFAULT="intel_pstate=disable"
And then updating grub.cfg
ala grub-mkconfig -o /boot/grub/grub.cfg
Follow the instructions for Arch kernel module loading
and add the acpi-cpufreq
module.
Well, well, turns out that the new pstate
Intel driver is awesome, but first one needs to practice a bit of the ancient, lost art of reading the documentation.
I'll leave my question as it is because, judging by all the grief and frustration I see scattered all around the internet, I am not the first to have this issues.
The new CPU driver has lots of options, but I will restrict my explanation to something simple and, for me, more than enough and satisfactory. First of all:
sudo apt-get install linux-cpupower
(or the equivalent in your non-debian based distros)
There are now 2 behaviors (governors) with the names powersave
and performance
but that is quite an unfortunate naming scheme, because these governors have nothing to do with those that bear the same names in the old driver:
powersave
means now variable frequency that depends on the load, i.e. this is essentially the old ondemand
governor. You get to set the minimum and maximum frequency, and if that maximum frequency is set to the maximum frequency your CPU is able of (which I believe it's the default) then you don't save a crap. You may even crank up the minimum frequency to the second highest value, and the result will be the CPU nearly at full throttle 24/7 and the governor will still be named powersave. They should have named this governor VARIABLE or something similar, avoiding a lot of confusion among users and sparing the developers a lot of false reports of kernel bugs.
performance
means here constant frequency, no matter the load, and this depends on what the user has set as maximum. When this governor is set, the mininum frequency is ignored and the CPU runs at the frequency you set as maximum. If as such you have set a very low frequency, then you will not see any special performance or anything, you just will get a slowed down CPU at constant frequency. So they'd better named this governor CONSTANT or something similar, sparing frustration to many people like me, used to the old scheme.
So, here are some examples that work like a charm, at least with kernel 4.14. I will use as minimum and maximum frequency the values for my CPU: 0.4 and 3.1 GHz. See yours with cpupower frequency-info
CONSTANT, LOWEST FREQUENCY IN ALL CORES
This IS what I wanted! We get that by setting the constant frequency governor and setting the lowest available frequency as the maximum:
sudo cpupower frequency-set -g performance
sudo cpupower frequency-set -u 400MHz
CONSTANT, HIGHEST FREQUENCY IN ALL CORES
(You see this asked very often for desktop computers where it makes sense, although there are also people out there willing to destroy their laptop fan)
sudo cpupower frequency-set -g performance
sudo cpupower frequency-set -u 3100MHz
VARIABLE FREQUENCY BETWEEN THE MINIMUM AND MAXIMUM POSSIBLE FREQUENCIES IN ALL CORES
(this was called ondemand with the old acpi-cpufreq
driver)
sudo cpupower frequency-set -g powersave
sudo cpupower frequency-set -d 400MHz
sudo cpupower frequency-set -u 3100MHz
VARIABLE FREQUENCY BETWEEN THE MINIMUM AND A MODERATE FREQUENCY IN ALL CORES
(maybe because you want to get some more speed when required but you don't want to reach the maximum and hear the fan blowing like mad)
sudo cpupower frequency-set -g powersave
sudo cpupower frequency-set -d 400MHz
sudo cpupower frequency-set -u 1200MHz
And so on. It is very easy and works really well. You can set too a constant low frequency in one core where the heavy numerical stuff is running, while you leave a variable frequency in other core where you launch the more usual stuff (email, web browsing...). See taskset
for more info.
Best Answer
For 3.x kernels
The interface to CPUFreq has changed in the newer kernels. This would include CentOS 6. You can read about the entire interface here in the Red Hat Enterprise Linux (RHEL) documentation titled: Chapter 3. Core Infrastructure and Mechanics.
Specifically the section on CPUFreq Setup. Here are the steps required to set it up.
CPUFreq drivers
load appropriate driver
install cpupower tool
view governors
So we currently only have these 3 governors loaded: ondemand, userspace, and performance.
loading governors that are missing
You can get a list of all governors that are available like so.
confirm modules thus far:
confirm which governors are loaded
viewing current policy
In the above output you can see my current policy is ondemand. To tune the policy and speed you use this command to do so:
confirm new governor
You can also tune the min/max CPU frequencies within a policy using the
cpupower frequency-set --min <freq> --max <freq>
. See this page for more details on what you can do withcpupower frequency-set
.doing the above without cpupowerutils
So finally, if you don't have the cpupowerutils package installed, you can interact with it similar to how you did in the previous 2.6 kernels. Mainly you echo values into the
sysfs
filesystem.for example
For 2.6 kernels
You can read about the various cpufreq features over on this site.
excerpt from CPU frequency scaling in Linux with cpufreq
I'd put a 0 in this file since this should be the default. If you have any long running niced process, which I highly doubt, you can set it to 1.