Green Computing using Linux

Laptop computers have for a long time had a number of power saving states and Linux is beginning to take advantage of this. Did you know your desktop computer can do it too?

With a resonably modern chipset, Linux kernel and BIOS you can scale your CPU frequency, save power and produce less wasteful heat.

Here's the official Gentoo HOWTO:

Here's an IBM DeveloperWorks article with more references: PDF version; Web version.

What is CPU scaling?

CPU scaling is the ability for the CPU clock speed to vary depending on its state. Wilst an idle state C4 will use less power than a fully-utilised state C0, an idle state running at half speed will use even less power. Why execute all those no-ops at full speed anyway?

Example 1: My Acer Ferarri 3400 laptop has an AMD Athlon 64 3000+ which supports states: 2GHz, 1.8GHz, 1.6GHz and 800MHz. This laptop when idle will run at 800MHz with the fan off but would physically overheat if running for a long period at full CPU speed. Frequency scaling keeps it cool and is likely to increase typical battery life from 1 hour to 2.5 hours.

Example 2: My desktop Acer T180 has a dual core Athlon 64 X2 which will run at speeds from 1GHz to 2.2GHz. The cores are lockstepped and will change speed simultaneously upon demand.

How to enable it:

If the BIOS will allow power saving, you will need to ensure it is enabled in the Linux kernel configuration. Most kernels from 2.4 onwards support this.

Enable "Power Management Support".

Under "ACPI support", enable appropriate things such as AC Adaptor, Battery, Button, Fan, Processor and Thermal Zone.

Under "CPU Frequency Scaling", enable such things as the "powersave" governor and "ondemand" governor. Also enable the relevant chipset drivers, such as the AMD Opteron/ Athlon64 PowerNow! driver and the ACPI Processor P-States driver.

Now re-compile and launch the new kernel configuration.

There is a useful set of files to look in for information, they are located under the directory /sys/devices/system/cpu/cpu0 (there may be more than 1 CPU listed). They may contain information similar to what follows:

scaling_available_frequencies = 2000000 1800000 1600000 800000
cpuinfo_cur_freq = 800000
scaling_available_governors = ondemand powersave userspace performance
scaling_governor = powersave
scaling_driver = powernow-k8

You can also look in /proc/cpuinfo which should show in this case show

cpu MHz : 800.00

You can watch this file as follows:

watch grep \"cpu MHz\" /proc/cpuinfo

Try running a cpu-intensive application, such as latex2html and see the frequency rise and then decrease again when the task is finished.

This may not work first time. Laptops typically have the powersave governor enabled. On desktop systems the kernel is typically set to the performance governor. This will need to be changed.

It still may not work. In this case the ondemand governor can be selected. To do this a Linux utility called cpufreq can be installed. You can test the speed using


and set the governor using

cpufreq-set -g ondemand

Now see what happens...

What are the system states?




What chipsets does it work with?

Chipset driver
Mobile AMD Athlon 64 powernow-k8
AMD Athlon 64 X2 powernow-k8
earlier Athlon K7 processors powernow-k7
Pentium P4/ D acpi-cpufreq

What is acpid?

Do not deploy acpid unless you know what you are doing. It is only really needed to manage events to switch between the various states described above. Events include such things as button presses, lid closing, etc. and are unlikely to be of interest on a desktop system.

If you want to put your Linux laptop system to sleep, this may be the way to go, but make sure you know how to wake it up again!

Edit | Attach | Watch | Print version | History: r4 < r3 < r2 < r1 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r4 - 18 Sep 2009 - RobAllan
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2021 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback