Here is a preamble. When doing inventory of Linux servers, that I'm administering, I've found that some of them are running on lower CPU speed, then they could. This can be easily checked with this command:
What you can see:
or
or even
Oops, we are paying for 2 Core 2Ghz CPU that runs on 600Mhz on one core and 1000Mhz on another!!!
There will be other lines for all the CPUs/cores/threads, probably with the same values.
This feature is nice, if we are running workstation, but what I've noticed, we do have the same CPU throttling on Ubuntu Server 10.04 builds and on CentOS 5.3, 5.4 and 5.5 builds (thus on RedHat too).
After hours of digging google, I've found that:
- this problem is very common
- there are several bug reports about this issue
- this is not BIOS settings problem, because on dual boot systems, CPU runs at full speed on Windows
- there are no 100% working solutions or they are too difficult to find
- this is not a bug, but a 'feature' of the new kernels, it is implemented differently on 2.6.18 (CentOS) and 2.6.32 (Ubuntu).
Here is a tip how to disable it on running system:
1) Check that 'kondemand' thread is running, run as root: "pgrep -lf ondemand"
the output should be like:
2) Check that current cpu speed differs from the maximum:
3) Change CPU governor from 'ondemand' to 'performance' for all CPUs/cores, run as root:
4) Check that your changes have been applied:
5) If you are running 'cpuspeed', 'cpufreqd', 'powerd' or other daemons, that can control CPU stepping, just stop them, if you really need to run your system on 100% of the CPU speed.
On CentOS:
6) On Linux 2.6.32 (On RedHat 6, and Oracle Unbreakable Linux 6) remove CPU scaling kernel modules:
Ensure that no 'kondemand' kernel threads are running:
7) To make changes permanent (on reboot):
- On Ubuntu, modify /etc/init.d/ondemand script:
change this
to this:
OR ALTERNATIVELY just remove all references to ondemand from /etc/rc?.d/
- On CentOS, just create a new script /etc/init.d/ondemand:
then enable it:
I'm using 'ondemand' name of the script, this may be a little bit misleading (because really it is a 'performance'), but you may change it.
Here are some useful links (just FYI, don't try to install cpufreq-set, cpufreq-get or other utilities, they will also install themselves as daemons, that will control your cpu speed regardless of your cpu governor settings):
1. http://www.redhat.com/doc
2. http://ego.randomwalk.in/
Regards,
Arty
by: jjmcd on 2011-02-03 at 06:16:56ID: 23448
With Ondemand, the CPU runs faster when it needs to, slower when it doesn't need to. This results in lower electrical use and temperatures, hence longer CPU life and lower electric and cooling bills.
If you do the "grep ... cpuinfo" enough times you will see several different results (presuming that your system actually has some sort of load). Better yet, add the cpu speed monitor to the panel so you can see it change as you do stuff. Of course, if your system isn't doing anything then usually it will show the lowest speed, while if it is fully loaded, it will almost always show the maximum speed. Your "grep ... cpuinfo" simply takes a snapshot, which may or may not be representative ... it's simply a roll of the dice.
For most workloads, Ondemand represents a nice balance between performance and energy use.. Performance supposedly leans towards performance a little more, but I have never been able to see a meaningful difference.
Simply locking the CPU speed at the max only means that you run the idle loop as fast as possible, while increasing CPU power consumption, CPU temperature and fan speed, while reducing the life of your CPU.
Personally, I've never been that concerned about seeing the idle loop run as fast as possible.