Saturday, November 13, 2010

Changing CPU frequency scaling governor policy on RHEL 5

After upgrading my processor to Intel Core i7 870 2.93GHz, I installed RHEL 5. To my surprise, /proc/cpuinfo shows CPU speed as 1.2GHz
# cat /proc/cpuinfo | grep "cpu MHz" | uniq
cpu MHz         : 1197.000

But my processor specification is 2.93GHz (with Turbo boost). I observed that processor speed increasing when there is load on machine. For example if I run this one terminal (to make a CPU work hard)
# cat /dev/urandom > /dev/null

And check speed of processor in another terminal, it shows
# cat /proc/cpuinfo | grep "cpu MHz"
cpu MHz         : 1197.000
cpu MHz         : 1197.000
cpu MHz         : 1197.000
cpu MHz         : 2927.000
cpu MHz         : 1197.000
cpu MHz         : 1197.000
cpu MHz         : 1197.000
cpu MHz         : 1197.000

One processor is working hard to dump random numbers into black hole. So, its speed increased to highest level. This is because, this processor supports frequency scaling. And RHEL 5 by default uses scaling governor policy as "ONDEMAND". It means CPUs run at low frequency and scale frequencies up when needed. 

To make all CPUs to run their highest speeds even when idle, scaling governor policy should be changed to "PERFORMANCE". The file /etc/sysconfig/cpuspeed contains an option for scaling governor policy.
GOVERNOR=ondemand
I changed this to
GOVERNOR=performance

And restarted cpuspeed daemon
# service cpuspeed restart
Disabling ondemand cpu frequency scaling:                  [  OK  ]
Enabling performance cpu frequency scaling:                [  OK  ]

Now, I can see that all processors are running at their highest speeds.
# cat /proc/cpuinfo | grep "cpu MHz"  | uniq
cpu MHz         : 2927.000

No comments:

Post a Comment