April 17, 2014
 
 
RSSRSS feed

Power Management on Linux, Part 1 - page 2

Off Means Not Really, But Only Sort of Off

  • April 10, 2008
  • By Carla Schroder
A very useful power management tool that is best for laptops, though it's also useful on servers and desktops, is the powertop command (see Figure 1). If you see the "no ACPI power usage estimate available" message, unplug your laptop. (Do I also have to say "don't unplug your server or desktop PC"?)

The Linux kernel itself used to be a restless critter than never truly rested, but had timer interrupt rates of 100 to 1000 Hz. This meant that 100 to 1000 times per second the kernel would look around for something to do. Lower Hz means less overhead, higher Hz means less latency. This changed with the release of the 2.6.21 kernel, also called the tickless kernel. When the tickless kernel is in idle mode, it's really being idle and therefore not twitching in a bored fashion, uselessly consuming power and generating heat.

powertop shows you which processes are pestering the kernel during idle periods, and it gives you an endless stream of tips for tuning your system for more power efficiency. Some items will be obvious, like turning off Bluetooth and wireless when you don't need them. Both are significant power users on laptops, and you'll get longer battery life without them. It's easy to measure the effects of your changes by watching the Power Usage line.

Some things are questionable, but worth trying. For example, the HAL daemon polls your CD/DVD drives constantly at 2 or 16-second intervals to see if new media have been inserted, so if you don't read CDs or DVDs very often it might be worth disabling it with the hal-disable-polling --device [devicename] command. Turn it back on with hal-disable-polling --enable-polling --device [devicename]. If you're thinking that this sort of polling seems a tad kludgy, you're right. man hal-disable-polling says:

"It is the position of the HAL team that polling should be avoided at all costs as long as it doesn't heavily impact the user experience in a negative way."
It also gives a lot of helpful information on how polling affects performance. The good news is that a genuine Asynchronous Event Notification Infrastructure, in which media changes will announce themselves instead of waiting shyly to be announced, is coming to the Linux kernel, and then we won't need polling anymore.

The Linux Skype client is a notorious CPU hog even when it is idle. There isn't much you can do to correct this except don't use it, though the Skype developers are working on the problem

Don't get too crazy shutting down everything just to get some clean powertop runs- that's not the point. The processes in bold are the significant ones to watch. It's better to lug around an extra battery than to obsess over shaving off fractions of watts and crippling functionality.

Come back next week and we shall penetrate the mysteries of suspend, hibernate, standby, and how to kill hard drives by being too energy-frugal.

Resources

Carla Schroder is the author of the Linux Cookbook and the Linux Networking Cookbook, and is a regular contributor to LinuxPlanet.

Sitemap | Contact Us