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
$ ls -1 /lib/modules/`uname -r`/kernel/arch/x86/kernel/cpu/cpufreq/
acpi-cpufreq.ko
mperf.ko
p4-clockmod.ko
pcc-cpufreq.ko
powernow-k8.ko
speedstep-lib.ko
load appropriate driver
$ modprobe acpi-cpufreq
install cpupower tool
$ yum install cpupowerutils
view governors
$ cpupower frequency-info --governors
analyzing CPU 0:
ondemand userspace performance
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.
$ ls -1 /lib/modules/`uname -r`/kernel/drivers/cpufreq/
cpufreq_conservative.ko
cpufreq_ondemand.ko
cpufreq_powersave.ko
cpufreq_stats.ko
freq_table.ko
$ modprobe cpufreq_powersave
confirm modules thus far:
$ lsmod |grep cpuf
cpufreq_powersave 1196 0
cpufreq_ondemand 10544 8
acpi_cpufreq 7763 0
freq_table 4936 2 cpufreq_ondemand,acpi_cpufreq
mperf 1557 1 acpi_cpufreq
confirm which governors are loaded
$ cpupower frequency-info --governors
analyzing CPU 0:
powersave ondemand userspace performance
viewing current policy
$ cpupower frequency-info
analyzing CPU 0:
driver: acpi-cpufreq
CPUs which run at the same hardware frequency: 0 1 2 3 4 5 6 7
CPUs which need to have their frequency coordinated by software: 0
maximum transition latency: 10.0 us.
hardware limits: 1.60 GHz - 3.20 GHz
available frequency steps: 3.20 GHz, 3.20 GHz, 3.07 GHz, 2.93 GHz, 2.80 GHz, 2.67 GHz, 2.53 GHz, 2.40 GHz, 2.27 GHz, 2.13 GHz, 2.00 GHz, 1.87 GHz, 1.73 GHz, 1.60 GHz
available cpufreq governors: powersave, ondemand, userspace, performance
current policy: frequency should be within 1.60 GHz and 3.20 GHz.
The governor "ondemand" may decide which speed to use
within this range.
current CPU frequency is 1.60 GHz (asserted by call to hardware).
boost state support:
Supported: yes
Active: yes
2500 MHz max turbo 4 active cores
2500 MHz max turbo 3 active cores
2500 MHz max turbo 2 active cores
2600 MHz max turbo 1 active cores
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:
$ cpupower frequency-set --governor performance
Setting cpu: 0
Setting cpu: 1
Setting cpu: 2
Setting cpu: 3
Setting cpu: 4
Setting cpu: 5
Setting cpu: 6
Setting cpu: 7
confirm new governor
$ cpupower frequency-info
analyzing CPU 0:
driver: acpi-cpufreq
CPUs which run at the same hardware frequency: 0 1 2 3 4 5 6 7
CPUs which need to have their frequency coordinated by software: 0
maximum transition latency: 10.0 us.
hardware limits: 1.60 GHz - 3.20 GHz
available frequency steps: 3.20 GHz, 3.20 GHz, 3.07 GHz, 2.93 GHz, 2.80 GHz, 2.67 GHz, 2.53 GHz, 2.40 GHz, 2.27 GHz, 2.13 GHz, 2.00 GHz, 1.87 GHz, 1.73 GHz, 1.60 GHz
available cpufreq governors: powersave, ondemand, userspace, performance
current policy: frequency should be within 1.60 GHz and 3.20 GHz.
The governor "performance" may decide which speed to use
within this range.
current CPU frequency is 3.20 GHz (asserted by call to hardware).
boost state support:
Supported: yes
Active: yes
2500 MHz max turbo 4 active cores
2500 MHz max turbo 3 active cores
2500 MHz max turbo 2 active cores
2600 MHz max turbo 1 active cores
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 with cpupower 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
$ echo 360000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq
For 2.6 kernels
You can read about the various cpufreq features over on this site.
ignore_nice_load - This parameter takes a value of '0' or '1'. When
set to '0' (its default), all processes are counted towards the 'cpu
utilization' value. When set to '1', the processes that are run with a
'nice' value will not count (and thus be ignored) in the overall usage
calculation. This is useful if you are running a CPU intensive
calculation on your laptop that you do not care how long it takes to
complete as you can 'nice' it and prevent it from taking part in the
deciding process of whether to increase your CPU frequency. To turn
this on do the following.
sudo sh -c "echo 1 > /sys/devices/system/cpu/cpu0/cpufreq/ondemand/ignore_nice_load"
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.
Best Answer
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=disable
powersave
andperformance
. 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 addingAnd then updating
grub.cfg
alagrub-mkconfig -o /boot/grub/grub.cfg
Follow the instructions for Arch kernel module loading and add the
acpi-cpufreq
module.