cpuspeed enables you to dynamically change the CPU speed of a processor through the ACPI daemon. I find it useful only for my laptop, and only when I do not have AC power. The default configuration is very annoying, which monitors the system's idle percentage and reduces or raises the CPU's clock speed and voltage accordingly to minimize power consumption when idle (theoretically). Furthermore, the cpuspeed script located in /etc/init.d/ has changed considerably in FC6, forcing cpuspeed to use the kernel to use the cpufreq-ondemand driver opposed to the cpufreq-powersave driver. We'll need to change both the init script as well as the configuration file. The configuration file is located in /etc/cpuspeed.conf. Edit the file using sudo:
~>
sudo nano
/etc/cpuspeed.conf
Scroll down to the "# Add your favorite
options here" line and comment out the line just below it. Commenting out this line removes the "-r" option
(restores previous speed on program exit), which will allow the system
to be governed by load, AC power, and temperature management only. With
that done, add the following instead:
OPTS="$OPTS -i 2 -C"
The "-i 2" option
changes the default response time to 2/10's of a second from 2 seconds
and the "-C"
option will ensure that the CPU runs at maximum speed when AC
power is connected and only at lower speeds if on battery
power or if the temperature of the processor is too high. Finally,
uncomment the last two "OPTS"
lines to allow cpuspeed
to actually check the state of the AC adapter and system
temperature:
OPTS="$OPTS -a
/proc/acpi/ac_adapter/*/state"
OPTS="$OPTS -t /proc/acpi/thermal_zone/*/temperature 75"
Save and exit. Now edit /etc/init.d/cpuspeed using sudo:
OPTS="$OPTS -t /proc/acpi/thermal_zone/*/temperature 75"
~>
sudo nano
/etc/init.d/cpuspeed
Scroll down to the first "centrino|powernow-k8)" line. Delete the following lines:
/sbin/modprobe cpufreq-ondemand
for i in /sys/devices/system/cpu/cpu*
do
echo ondemand > $i/cpufreq/scaling_governor
done
RETVAL=0
;;
Replace the lines that you just deleted with the following code:
for i in /sys/devices/system/cpu/cpu*
do
echo ondemand > $i/cpufreq/scaling_governor
done
RETVAL=0
;;
# The following is a code replacement
#/sbin/modprobe cpufreq-ondemand
/sbin/modprobe cpufreq-powersave && success || failure
RETVAL=$?
for i in /sys/devices/system/cpu/cpu*
do
# echo ondemand > $i/cpufreq/scaling_governor
echo performance > $i/cpufreq/scaling_governor
done
#RETVAL=0
echo -n $"Starting $prog (loading cpufreq_powersave module: "
echo
[ $RETVAL = 0 ] && touch /var/lock/subsys/cpuspeed
;;
# End of changes
The changed code will allow cpuspeed to use the cpufreq-powersave
driver, which scales the CPU based upon the availability of
AC power. A message will also be displayed to the screen indicating
that cpuspeed is starting. Next, scroll down to the second "centrino|powernow-k8)" line. Delete the following lines:
#/sbin/modprobe cpufreq-ondemand
/sbin/modprobe cpufreq-powersave && success || failure
RETVAL=$?
for i in /sys/devices/system/cpu/cpu*
do
# echo ondemand > $i/cpufreq/scaling_governor
echo performance > $i/cpufreq/scaling_governor
done
#RETVAL=0
echo -n $"Starting $prog (loading cpufreq_powersave module: "
echo
[ $RETVAL = 0 ] && touch /var/lock/subsys/cpuspeed
;;
# End of changes
sbin/rmmod cpufreq-ondemand
RETVAL=0
;;
Replace the lines that you just deleted with the following code:
RETVAL=0
;;
# The following is a code replacement
#/sbin/rmmod cpufreq-ondemand
#RETVAL=0
/sbin/rmmod cpufreq-powersave && success || failure
RETVAL=$?
echo -n $"Stopping $prog (removing cpufreq_powersave module): "
echo
[ $RETVAL = 0 ] && rm -r /var/lock/subsys/cpuspeed
;;
# End of changes
The changed code will remove the cpufreq-powersave driver when cpuspeed is stopped and display an appropriate message on the screen. Finally, scroll down to the "status)" line and delete the following:
#/sbin/rmmod cpufreq-ondemand
#RETVAL=0
/sbin/rmmod cpufreq-powersave && success || failure
RETVAL=$?
echo -n $"Stopping $prog (removing cpufreq_powersave module): "
echo
[ $RETVAL = 0 ] && rm -r /var/lock/subsys/cpuspeed
;;
# End of changes
status cpuspeed
;;
Replace the lines that you just deleted with the following code:
;;
# The following is a code replacement
if /sbin/lsmod | /bin/grep cpufreq_powersave >/dev/null; then
echo -n "$prog is running as the kernel module cpufreq_powersave..."
echo
else
status cpuspeed
fi
;;
# End of changes
The changed code will test the presence of the cpufreq-powersave driver when the status of cpuspeed is queried. With these changes implemented, save and exit.if /sbin/lsmod | /bin/grep cpufreq_powersave >/dev/null; then
echo -n "$prog is running as the kernel module cpufreq_powersave..."
echo
else
status cpuspeed
fi
;;
# End of changes
Now restart the daemon:
~>
sudo service cpuspeed
restart
You should see cpuspeed stop and restart:
Stopping
cpuspeed (removing cpufreq_powersave module):
[ OK
]
Starting cpuspeed (loading cpufreq_powersave module): [ OK ]
As a final note, cpuspeed does not have a
man page. =p To determine the different options for the
daemon, type:
Starting cpuspeed (loading cpufreq_powersave module): [ OK ]
~>
cpuspeed --help
cpuspeed is now configured.

