Sluggish response with cpuspeed!

Background

(System 2Xdual core opteron 280 - 2.4GHZ)

I upgraded my system and linux OS and noticed even when recompiling the kernel in parallel mode, it was behaving very sluggish.  I kept looking at /proc/cpuinfo and it showed me MHZ like 1000-1800.

It turned out the culprit was the cpuspeed daemon or more accurately the settings in /etc/cpuspeed.conf.  At least under Red Had,  the current settings are setup for laptops to maximize battery life.  But what about workstations how does one maximize performance under cpuspeed.  It turns out a lot of others have had similar issues, but from what I could find on the web, they concluded that cpuinfo just couldn't cut it and went on to some alternate method of speed settings or disabled cpuspeed and have the system going at full speed all of the time.

The following is how I got cpuspeed to behave on my system.  NOTE: I am not have the numbers perfect (as I still am guessing on the settings).  But for me the performance is now there instantly when I need it and when I am not tasking it the cpus down down to 42% of their original clock rate (2.4 -> 1.0).

Initial cpuspeed.conf

Looking at the standard contents of this file on my system:

% cat /etc/cpuspeed.conf

VMAJOR=1
VMINOR=1

# uncomment this and set to the name of your CPUFreq module
#DRIVER="powernow-k7"

# Let background (nice) processes speed up the cpu
OPTS="$OPTS -n"

# Add your favorite options here
#OPTS="$OPTS -s 0 -i 10 -r"

# uncomment and modify this to check the state of the AC adapter
#OPTS="$OPTS -a /proc/acpi/ac_adapter/*/state"

# uncomment and modify this to check the system temperature
#OPTS="$OPTS -t /proc/acpi/thermal_zone/*/temperature 75"

Well, great how do I set my favorite options in this file, if I don't know what choices there are or wht they do?  There is no man page for cpuspeed, but if you do a:

% cpuspeed -help

You will get some info like:

cpuspeed v1.2.1

This program monitors the system's idle percentage and reduces or raises the
CPUs' clock speeds and voltages accordingly to minimize power consumption
when idle and maximize performance when needed. This is the default.

The program may also optionally be configured to reduce the CPUs' clock
speeds if the temperature gets too high, NOT minimize their speeds if the
computer's AC adapter is disconnected or maximize their speeds when the AC
adapter is connected.

By default this program will manage every CPU found in the system.

Usage: cpuspeed [Options]

Options:
-d
Tells the process to daemonize itself (run in background).

-i
Sets the interval between idle percentage tests and possible speed
changes in tenths of a second (default is 20).

-n
Includes nice time as cpu time (off by default)

-p
Sets the CPU idle percentage thresholds. is the idle
percentage below which a CPU will be set to the highest possible
speed. is the idle percentage above which a CPU's
speed will be decreased and below which a CPU's speed will be
increased (defaults are 10 and 25).

-m
Sets the minimum speed in KHz below which a CPU will not be set.

-M
Sets the maximum speed in KHz above which a CPU will not be set.

-t
Sets the ACPI temperature file and the temperature at which CPUs
will be set to minimum speed.

-T
Sets the interval at which the temperature will be polled in
tenths of a second (default is 10).
(Requires the '-t' option above.)

-a
Sets the ACPI AC adapter state file and tells the program to set
the CPUs to minimum speed when the AC adapter is disconnected.
(This is the default but is changeable by the '-D' option below).

-A
Sets the interval at which the AC adapter state will be polled in
tenths of a second (default is 50).
(Requires the '-a' option above.)

-C
Run at maximum speed when AC adapter is connected.
(Requires the '-a' option above.)

-D
Do NOT force minimum speed when AC adapter is disconnected.
(Requires the '-a' option above.)

-r
Restores previous speed on program exit.

-s
Manage only a single CPU. specifies the number of the CPU
to manage and is in the range 0 to (n-1) where 'n' is the number
of CPUs in the system. Without this option the program creates
copies of itself to manage every CPU in the system.

To have a CPU stay at the highest clock speed to maximize performance send
the process controlling that CPU the SIGUSR1 signal.

To have a CPU stay at the lowest clock speed to maximize battery life send
the process controlling that CPU the SIGUSR2 signal.

To resume having a CPU's clock speed dynamically scaled send the process
controlling that CPU the SIGHUP signal.

Author:
Carl Thompson - cet [at] carlthompson.net (copyright 2002 - 2005)

Most of this I can sort of make sense of but the one crucial one that I thought needing setting was -p <fast up> <threshold>.  But I really don't understand what it is saying.  The default values are 10 and 25 respectfully.  I don't know if this is right, but I am thinking that the second parameter has to do with the percentage that the CPUs are idle.  So my thinking to maximize performance as long as the CPUS have 5% of work to do (or 95% idle) then I want them going at top speed.  So the values that I went with were -t 10 95.  (As I set up top, I don't have a clue what I am doing, but the numbers do give me instant speed when its needed and things slow down when the system is fairly quite)

Final cpuspeed.conf file

So here is my current /etc/cpuspeed.conf file:

VMAJOR=1
VMINOR=1

# uncomment this and set to the name of your CPUFreq module
#My machine is using opterons so this is the right driver for me.
#You will need to find the right one for your system
DRIVER="powernow-k8"

# Let background (nice) processes speed up the cpu
OPTS="$OPTS -n"

# Add your favorite options here
OPTS="$OPTS -i 10 -p 10 95"

# My motherboard has onboard fan control in the Bios, so I'm bothering with this
# uncomment and modify this to check the system temperature
#OPTS="$OPTS -t /proc/acpi/thermal_zone/*/temperature 75"

Date: Sat Apr 14 16:50:24 PDT 2007