Linux systems' power consumption is rapidly becoming a top concern for operators of large datacentres. A University of California study recently attributed 90 percent of the increase in datacentre power consumption to servers priced at less than $25,000 each -- the market where Linux is most important.
But until recently, kernel developers have focused mostly on correctness and performance, leaving the hardware's power-saving features largely unused.
This year, the trend is finally turning around. Problems that get measured get fixed, and an alliance of developers representing many different projects is coming together around a modest-looking, text-based tool called PowerTOP. PowerTOP's author is Arjan van de Ven, a Linux developer working at Intel.
Thanks to new functionality called "tickless," Linux systems can go into low-power states -- and stay there -- without having to handle an internal timer every 100th to 1,000th of a second. But the catch is that any program that does unnecessary work will wake up the whole machine, giving up the power savings.
PowerTOP's documentation explains, "Current processors save a lot of power if they are idle for long periods, which translates into a longer battery life for your laptop, or a lower energy bill for your datacentre. However, a Linux system consists of more software than just the kernel, and there are many tunables involved. It's not easy to see what is going on, and as a result the behaviour is sometimes far from optimal, and a lot of power is wasted."
In other words, some of the software on a Linux system is like the person who turns the lights on when he enters a room and then leaves them on when he departs a minute later. PowerTOP points the finger at programs that wake up the system.
When van de Ven first announced PowerTOP this May, Intel launched a companion website featuring some power-saving measures that the tool uncovered.
A few have been simple tweaks, such as switching from blinking to non-blinking cursors, but most are just examples of power-insensitive coding.
For example, according to the site, one popular program "will also ask the X server every five seconds if the X server supports the X screensaver extension.... the X server either supports or doesn't support this, this isn't changing after starting the application."
Now that PowerTOP is making the rounds of Linux users, the tool's users are filing more bugs with the maintainers of the software they use. "What we're seeing is mostly that, now that PowerTOP is well known, people report issues mostly directly to the upstream projects' bug-tracking tools or mailing lists rather than to us," van de Ven wrote in an email interview.
On x86 systems, a hardware feature called High Precision Event Timers (HPET) makes longer sleep times possible. At the Ottawa Linux Symposium, Intel developer Len Brown explained the differences between several kinds of timer hardware available on x86 systems. A timer built into the processor doesn't work for timing processor wakeups, because it sleeps when the processor does. Another timer, the programmable interval timer, can only be set for 27 milliseconds or less. HPETs stay awake when the processor sleeps and can be set for up to three seconds, but many BIOSes turn off HPET support.
The PowerTOP project has a kernel patch to turn HPET on, and van de Ven says he has submitted it to Andrew Morton for testing. "I have good hopes that the patch will go to mainline for 2.6.24," he says.
The Fedora Project released Version 7 of its Linux distribution shortly after tickless support entered the kernel, so Fedora users have been among the first exposed to PowerTOP.
Fedora kernel maintainer Dave Jones explained PowerTOP's attraction to tweak-crazy Linux users in an email interview. "It hasn't been without its problems, but it's definitely attractive to have a power-conscious user base, and PowerTOP has brought a whole bunch of people around to thinking, 'Hey, my computer is busy doing nothing'," Jones says. "One of the key plus points of PowerTOP was that it's a tool that anyone can run and understand, and give valuable feedback to developers.
So we end up seeing profile data from a whole bunch of use-cases that otherwise we wouldn't have thought to even profile."
Jones plans to integrate the HPET patch to help the users who can't get full benefit from tickless because their BIOSes turn HPET off. Fedora, like other community distributions, makes recent kernel code available through its software update system, to encourage users to test.
An earlier version of the HPET patch caused some systems running Fedora's preliminary testing "rawhide" releases not to boot, Jones says, and he removed it temporarily. But, he says, "force-enabling the HPET is a 'must have' ... as there are more than enough BIOSes out there that don't enable it, forgoing a very useful hardware feature."
Since the bug appears to be fixed, Jones says he's planning to integrate it into a future update for Fedora Core 6 and Fedora 7. That means that users will be able to upgrade to it automatically, simply using the same package manager that they use to pick out ordinary applications.
With the infrastructure to support the tickless kernel and increased power savings falling into place, much of the work now falls on Linux users, who can make a meaningful contribution simply by running their own systems with PowerTOP and reporting on the results. PowerTOP will be the subject of a birds-of-a-feather session at LinuxWorld Conference and Expo.
By fixing obvious power problems in community distributions now, PowerTOP has the potential to offer cuts in datacentre costs when vendors release the next versions of their enterprise distributions based on longer-tested versions of the same software. Power savings could well be the selling point that drives the next round of Linux software upgrades. Today, the benefits accrue to developers and laptop users. "My own laptop has about an hour extra battery life," says van de Ven.
The power used by disk drives could be the next target for PowerTOP measurements. "The biggest thing I'm looking at is getting 'who accesses the disk' information into PowerTOP," says van de Ven. "So far, it has proven to be not the easiest task, but I'm confident we'll get it at some point."