All modern CPUs (AMD Athlon 64 and Intel Core series to name the most popular) support functionality called “CPU power scaling”. This means that when the CPU is not doing anything, ie. is sitting idle or doing only some light work, it runs at lower clock speed and lower voltage than normally. When CPU is loaded, the speed is adjusted accordingly so that you get the full power to your hands.
So in essence, the point is to reduce the speed of the CPU when the speed is not needed and call it back as soon as there is something to do. Makes sense, doesn’t it? The sad thing is.. you need to do this yourself, because by default this functionality is disabled. This post goes to explain how.
Case: our home server
As nowadays our home server is the only piece of electronic hardware that run 24/7 in our apartment, I have had a project on reducing it’s power consumption. Surprisingly move from power-hungry (at it’s time) Athlon XP to more power efficient Athlon 64 X2 did not help much. I guess the motherboard itself, Asus A8N-SLI Deluxe, and its NForce 4 chipset consume too much and balance for the more energy-efficient CPU. Then again, now the gigabit ethernet runs on PCI Express bus, machine has 2G instead of 256M of main memory, there is four hard drives instead of three and naturally the dual-core CPU has at least three times the horsepower compared to the old one, so still running at almost the same AC power is not that bad in the end.
Now, to the benefit of all the potential googlers and to help my own memory, follows a brief description of how I got the power saving enabled and how I checked it actually works.
OS: Ubuntu Linux Hardy
CPU: AMD Athlon(tm) 64 X2 4600+
Mobo: Asus A8N-SLI Deluxe
Memory: 4G DDR-400 total
PSU: Antec 350W, bundled
ST3120022A Seagate Barracuda 7200.7 120G
WD3000JB-00KFA0 Western Digital Caviar SE 300G
ST3160023A Seagate Barracuda 7200.7 160G
WD6400AAKS-00A7B0 Western Digital Caviar 640G
Without CPU performance scaling enabled: 124-131W AC on light load/idle.
With CPU performance scaling enabled: 110-116W AC on light load/idle.
Saving: 14 to 15W AC.
In this particular case the savings are not tremendous.. I really should look into replacing the PSU with a modern one. But still, 15W 24/7 is energy wasted.
Notes: the hard drives are not the definitely most quiet models available, mostly because I buy server hard drives when some old ones fails and thus I want something that’s available right now, right here. Still all of those four drives running on hard surface are easily drown by the sound of quiet 92mm and 80mm fans keeping the CPU and chipset cool.
Seeing how the CPU runs
This applies to both Linux and Windows: Go to http://www.amd.com/us-en/Processors/TechnicalResources/0,,30_182_871_13118,00.html and download the AMD Power Monitor. Install it and run to see your CPU speed and voltage:
What you want to see is to have the voltage be reduced to 1.1V and clock speed to 1GHz when the machine is idle and then check that it rises back to full speed (like 3200MHz and 1.4V) when machine is loaded. Especially the voltage reduction is important - clock speed increases power usage linearly while core voltage increases power usage to second power or more.
To install the Power Monitor to my Ubuntu box I first installed Alien by running
apt-get install alien
as root. Then I downloaded the Power Monitor rpm (tagged RHEL 32-bit in this case) and used alien to create .deb of it:
Then installed the resulting .deb:
dpkg -i powermonitorlinux_1_0_4-1_i386.deb
And finally ran the Power Monitor itself:
Note that this is X program - so you need to have X support. In my case I ran it remotely by running and X server on my Windows box, but you can naturally run it locally, too, if you have X running.
To actually install the CPU scaling support I followed this tutorial: http://ubuntuforums.org/showthread.php?t=248867. It should work equally for Debian, too.
Since I am running stock Hardy kernel, 2.6.24 derivative, the necessary modules were already compiled with my kernel, so I needed just to make sure they are loaded at every boot and then configure them to save energy by enabling mode