AMD X2 PowerNow! & Linux performance

After upgrading to a new AMD X2 4400 system everything felt rather sluggish. This was due to default PowerNow! (cpufreq) settings of Fedora Core 4 – which are not really suitable for desktop machines.

The easy solution would have been to disable PowerNow!/cpufreq totally, leaving the system running at full speed all the time. But being able to run cooler and save power, when the system was otherwise idle, seems like a good idea. Especially if the lower temperatures allow the fans to run at lower speeds and therefore produce less noise.

What was not desirable was to not have the system running slowly when there was something running that needed the CPU.


The support for PowerNow! is indicated in the bootup logs and shows the available frequency/voltages that are support by cpufreq for the AMD X2, an X2 4400 in this example:

powernow-k8: Found 2 AMD Athlon 64 / Opteron processors (version 1.50.4)
powernow-k8:    0 : fid 0xe (2200 MHz), vid 0x8 (1350 mV)
powernow-k8:    1 : fid 0xc (2000 MHz), vid 0xa (1300 mV)
powernow-k8:    2 : fid 0xa (1800 MHz), vid 0xc (1250 mV)
powernow-k8:    3 : fid 0x2 (1000 MHz), vid 0x12 (1100 mV)
cpu_init done, current fid 0xe, vid 0x8

Fedora Core 4 & cpuspeed

The default configuration for Fedora Core 4 is to use a user space cpufreq governor cpuspeed which is configurable via a configuration file /etc/cpuspeed.conf. By default this was very slow to change up speeds which resulted in everything feeling slow. By the time the speed change happened whatever triggered it no longer needed the extra speed and the system slowed down again.

I’d previously used Fedora Core 4 on a notebook without any issues. In fact the slow change up was a good thing for power saving and keeping the fan from running, and on a slower machine the delay was no where near as noticeable.

Initially I played with the configuration of cpuspeed in an attempt to make it switch up faster but no matter what the settings it always felt rather slow at noticing the load change and changing speeds.

Kernel based cpufreq governors

The problem with a fast desktop is that the power saving is only really enabled to save power and keep heat down. It shouldn’t be saving power when it’s got anything work at all to do. The kernel based cpufreq governors should be able to switch speeds much faster than a user level governor.

After much research I decided the the ondemand governor was the only one that was really suitable.

First I stopped and disabled cpuspeed:

/etc/init.d/cpuspeed stop
/sbin/chkconfig cpuspeed off

Then loaded the ondemand cpufreq governor:

/sbin/modprobe cpufreq_ondemand
echo ondemand > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor

This had the effect of giving much faster up and down speed changes, although it still suffered from two issues:

  1. Not all processes were triggering a speed change;
  2. It was sometimes still not fast enough to change up speed;

The first issue turns out to be due to background tasks (niced tasks) not being considered when deciding if the cpu was being used and a speed change was needed. Since I wanted the speed to be used whenever something wanted it I disabled this special treatment of niced tasks:

echo 1          > /sys/devices/system/cpu/cpu0/cpufreq/ondemand/ignore_nice

The second issues was due to the up-shift in speed not happening until the cpu load reached 80%. This felt too late. I really wanted the system to run at full speed all the time and only slow down when there was nothing to do. Changing the load required before up-switching helped resolve this issue. I reduced it to 40% load before up-switching:

echo 40         > /sys/devices/system/cpu/cpu0/cpufreq/ondemand/up_threshold

Things are now run pretty well. The system up switches speed extremely quickly as soon as any load appears and the entire system feels far better than before.

cpu0 and/or cpu1?

I’ve been asked when I only change the settings on cpu0 and not both cpu0 and cpu1. The reason is that in the AMD X2 the settings are tied together – you cannot change one core by itself. You can see this by looking at the settings for cpu1 after changing them for cpu0 – the corresponding entry for the other cpu will have been changed at the same time.


The following changes to a default Fedora Core 4 install were done to improve the performance considerably:

Stop and disable cpuspeed:

/etc/init.d/cpuspeed stop
/sbin/chkconfig cpuspeed off

Edit /etc/rc.d/rc.local and add commands to switch to the ondemand governor and configure it at boot time:

# Use the ondemand cpufreq governor
/sbin/modprobe cpufreq_ondemand
echo ondemand   > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
echo 1          > /sys/devices/system/cpu/cpu0/cpufreq/ondemand/ignore_nice
echo 40         > /sys/devices/system/cpu/cpu0/cpufreq/ondemand/up_threshold

  One Response to “AMD X2 PowerNow! & Linux performance”

  1. Saya tertarik dengan tulisan anda mengenai Linux . Saya juga mempunyai tulisan yang sejenis mengenai Linux yang bisa anda kunjungi di
    klik disini

 Leave a Reply

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>