how to set the cpu speed scaling governor

CPUfreq allows the cpu speed to be dynamically adjusted based on system load. the rules for adjusting the speed are defined by the cpufreq governor. the rules can be: userspace, ondemand, or performance .

these may require the loading of a kernel module eg.:

modprobe cpufreq_ondemand

to check the current policy:

# cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_governors
userspace performance
# cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
userspace

to select a particular policy (in this case, ondemand):

# cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_governors
ondemand userspace performance
# echo ondemand > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
# echo ondemand > /sys/devices/system/cpu/cpu1/cpufreq/scaling_governor
# echo ondemand > /sys/devices/system/cpu/cpu2/cpufreq/scaling_governor

on redhat, to have this set at boot:

ed /etc/sysconfig/cpuspeed <<EOM
/^GOVERNOR=/
s/=.///=ondemand/
w
q
EOM