Software-based energy savings


Instead of patching the modules that regularly wake up the processor, you can simply unload them – of course, this assumes they are not needed.

If you do not need the computer to communicate in the next few minutes, just unload the modules for Bluetooth, WLAN, and Ethernet.

For Bluetooth, check first, by running the hciconfig command, to see whether a Bluetooth device is active.

Then stop the Bluetooth daemon and remove the module (you need to be root to do so):

# /etc/init.d/bluetooth stop
# modprobe -r hci_usb

The same thing applies to WLAN adapters. To find out which module handles the wireless connection, run lsmod, and run iwconfig to discover the wireless device's name.

The next two commands down the adapter and unload the module for an Intel 4965AGN WLAN card:

# ifdown wlan0
# modprobe -r iwl4965

If you rely on a wireless connection, why not make use of the WLAN card's power-saving feature. For cards that use the ipw2100 or ipw2200 driver, you can enable the feature with the following command:

# iwpriv wlan0 set_power 7

To discover whether your card supports the set_power option, you can type iwpriv without parameters. More recent WLAN adapters that use the iwl3945 or iwl4965 drivers can be switched to power-saving mode as follows:

# echo 5 > /sys/bus/pci/ drivers/iwl4965/*/power_level

This setting does not affect the connection. The value that follows echo stands for the power-saving mode: 1 saves the least and 5 the most – 6 disables the function.

On our lab system (a Lenovo X61s), I saved around 1.4 watts (which is equivalent to 10 percent) by switching to the power-saving mode.

It might be worth your while to disable USB 1.1 on a notebook. USB mice and other USB 1.1 devices will not work after doing so, but integrated USB 2.0 devices such as touchpads or pointers will continue to provide normal service. To do this, unload the uhci_hcd module. On our lab machine, this reduced overall consumption by a further 10 percent, and it also helped to keep the heat down.

Deep Sleep

Unloading drivers switches off a computer's components individually. And if you will not be using the computer for an extended period of time, you can switch it to suspend mode. Suspend-to-RAM and Suspend-to-Disk typically work fine on more recent hardware. The advantage of saving the session data in RAM is that the computer boots extremely quickly when you need it. On the other hand, Suspend-to-Disk does not consume any power, and it prevents data loss in case of a power outage.

Hard Disk

The hard disk is another major power consumer. Depending on the amount of work it has to do, it would need a fair amount of power if the drive motor runs continuously. Again, this is a component that you can stop: type hdparm -S N /dev/sda. The value N multiplied by five is the inactivity span in seconds, after which the hard disk automatically switches off. A value of 0 disables this feature.

This does not mean that the hard disk automatically stops spinning: Just as in CPU sleep mode, some standard system settings keep on waking up the disk. One reason is the speed at which the kernel writes the disk cache out to the disk. To discover the value for your machine in hundredths of a second, you can check the /proc/sys/vm/dirty_writeback_centisecs file.

Set kernel access to 10 minutes with the following command:

# echo 60000 > /proc/sys/vm/dirt y_writeback_centisecs

Assuming your cache is big enough, the system will not even need to trouble the disk to write a file. But remember that buffered data will be lost in case of a power failure.

The syslog daemon can sabotage hard disk sleep mode. It regularly writes logs directly to disk without using the buffer, but you can add a - sign at the start of each entry in your /etc/syslog.conf file to tell the daemon to use the disk cache in the future. Again, remember the danger of data loss in case of power failure.

Mounting Ext3 filesystems with the noatime parameter – or for files that require the atime option, with the nodiratime or relatime parameters – avoids further power-hungry disk accesses [4]. By default, Linux uses the atime parameter when mounting Ext3 filesystems. This tells Linux to log the last file access times and record timestamps at short intervals, which in turn means regular disk access and power consumption.

The developers of Laptop Mode tools [5] advise against using this power-saving feature on desktop PCs: Hard disks for desktops differ from laptop models in that they are designed for non-stop use, but not for being powered on and off at short intervals [6].

The Laptop Mode tools are a big help if you need to enable the kernel's notebook support features and are easily customized by means of a file (see the "Laptop Mode Tools" box). The tool, which you will find in the repositories of many distributions, helps you save power by focusing mainly on the hard disk and its power-saving modes. If necessary, it will change system settings that cause the disk to start unnecessarily.

The tools support a number of additional power-saving options: they automatically enable the power-saving configuration when you switch to battery power and enable the Centrino WLAN adapter power-saving feature, support hibernation in case of a low battery state, start or stop daemons depending on the power supply, and modify the display brightness.

Buy this article as PDF

Express-Checkout as PDF
Price $2.95
(incl. VAT)

Buy Linux Magazine

Get it on Google Play

US / Canada

Get it on Google Play

UK / Australia

Related content

  • Charly's Column

    Beep and power off! Large displays and faster CPUs seemingly wipe out the benefits of advances in battery technology. PowerTOP helps power hogs keep their laptops running without mains power.

  • PowerTOP 2.0

    The PowerTOP tool developed by Intel helps you save power. In version 2.0, it can also handle GPUs and offers advanced tracking features.

  • Power Management Tools

    Linux offers several tools that help users analyze the power consumption of hardware components.

  • AcpiTool and PowerTOP

    AcpiTool and PowerTOP ensure a sustainable battery lifetime and guarantee low energy consumption of laptops running Linux by identifying power hogs and maintaining the battery.

  • PowerTOP

    Intel’s PowerTOP analysis tool helps optimize power usage and shows you the power guzzlers hiding out on your operating system.

comments powered by Disqus
Subscribe to our Linux Newsletters
Find Linux and Open Source Jobs
Subscribe to our ADMIN Newsletters

Support Our Work

Linux Magazine content is made possible with support from readers like you. Please consider contributing when you’ve found an article to be beneficial.

Learn More