From Fedora Project Wiki
(Setting back to Category:FeatureReadyForWrangler after fixing the page)
Line 125: Line 125:


* See [[Talk:Features/PowerManagement]]
* See [[Talk:Features/PowerManagement]]
[[Category:FeatureReadyForWrangler]]
[[Category:FeatureReadyForFesco]]

Revision as of 15:27, 5 February 2009

Power Management improvements

Summary

Improve the current state of power management, especially in regard to userland.

Owner

  • Phil Knirsch <pknirsch@redhat.com> (Lead, tuned, monitoring, documentation)
  • Jiri Skala <jskala@redhat.com>(BLTK packager)
  • Marcela Maslanova <mmaslano@redhat.com> (initscript/udev service start/stop automation)

Current status

  • Targeted release: [Fedora 11]
  • Last updated: (02/05/09)
  • Percentage of completion: 15%

Detailed Description

Power management and power saving in Fedora has been a topic is special areas over the last few releases. Using powertop especially for Fedora 9 quite a few improvements were already done, but there is still lots of things that haven't been touched in regard to power saving.

Benefit to Fedora

Simple: On average use less power for turned on machines while not affecting user experience (a lot ;)).

Scope

  • Review and fix behaviour of typical applications in a full installed Fedora in regard to:
    • CPU wakeups
    • Disk IO
    • Network IO
  • Add a workload measurement package to Fedora (BLTK adapted to Fedora use case)
  • Enable relatime for filesystem by default during installation
  • Write a monitoring and tuning daemon that adapts system settings to the current use
  • Review services and make a framework that will allow services to start depending on installed hardware or software
  • Provide scripts and documentation to perform an individual review of a system and tips & tricks on how to improve it

Test Plan

For power measurement

  1. Default installation of a specific release to test
  2. Run several workload tests:
    1. Not logged in, gdm
    2. Logged in, start Firefox, Thunderbird and Openoffice
    3. Run a httpd server on it with a fixed index.html (http://pknirsch.fedorapeople.org/PM/index.html) and run the following script from a separate machine:
for i in seq 59 -2 0; do ab -t $((60-$i)) -c 32 http://myhost/index.html; sleep $i; done > result.txt
  1. For each workload run the following script on the test machine (1):
for i in seq 31; do date; powertop -d -t 60; done > restult.txt
  1. Alternatively you can use the latest version of DeviceKit-power and run the following:
for i in seq 31; do date; devkit-power --wakeups; done > restult.txt

For monitoring application behaviour

  1. Default installation of a specific release to test
  2. Run on of the following tools/scripts:
    1. Powertop or the latest gnome-power-manager to identify application wakeups
    2. netdevstat.stp to identify applications network behaviour (2)
    3. diskdevstat.stp to identify applications disk behaviour (2)

(1) In order to be able to see the actual power usage of the test machine you need to have some form of power measurement equipment. This can be either an external wattmeter or you can use a laptop as testmachine and run the tests on battery power.

(2) Both can be found in the contrib/ directory of the tuned git repo: http://fedorapeople.org/gitweb?p=pknirsch/public_git/tuned.git;a=summary which can be cloned using git clone git://fedorapeople.org/~pknirsch/tuned.git

User Experience

As power saving is not really visible without a measuring it the effects will not be directly visible. So in order to really see the effect you'll either need a laptop and run that on battery power or a wattmeter that is hooked between your system and the power line.

Dependencies

  • Anaconda changes (for relatime)
  • Fixes need to get included to have an effect (really ;)).

Contingency Plan

Make sure none of the more aggressive power saving features breaks on common hardware and back it out it case it does.

Documentation

Simple user tips for improving power usage

  • Use a properly dimensioned system for the job (no need for overpowered systems for simple Desktop use e.g.)
  • For servers consolidate services on fewer systems to maximize efficiency of each system
  • Enforce turning of systems that are not used (e.g. company policy)
  • Unplug and/or turn of peripherals that aren't used (e.g. external USB devices, monitors, printers, scanners)
  • Turn of unused hardware already in BIOS.
  • Disable power hungry features.
  • Enable CPU scaling if supported for ondemand CPU governor. DONT use powersave governor, typically uses more power than ondemand (race to idle).
  • Put network card to 100 mbit/10 mbit:
    • 10 mbit: ethtool -s eth0 advertise 0x002
    • 100 mbit: ethtool -s eth0 advertise 0x008
    • Doesn't work for every card
  • Put harddisk to spindown fast and full power saving:
    • hdparm -S240 /dev/sda (20m idle to spindown)
    • hdparm -B1 /dev/sda (Max powersave mode)
  • Make sure writes to hd don't wake it up too quickly:
    • Set flushing to once every 5 minutes
    • echo "30000" > /proc/sys/vm/dirty_writeback_centisecs
    • Enable laptop mode
    • echo "5" > /proc/sys/vm/laptop_mode
  • Use relatime for your / partition
    • mount -o remount,relatime /
  • Disable CD-ROM polling from HAL (prevents popups when a CD is inserted):
    • hal-disable-polling --device /dev/scd0
  • Enable USB autosuspend by adding the following to the kernel boot commandline:
    • usbcore.autosuspend=5
  • Screensaver needs to dpms off the screen, not just make colors black. To turn of monitor after 120s when X is running:
    • xset dpms 0 0 120

Simple programmer tips for improving power usage

  • Wake up only when necessary
  • Do not poll in programs or use short regular timeouts, rather react to events
  • If you wake up, do everything at once (race to idle)
  • Use large buffers to avoid frequent disk access. Write one large block at a time
  • Don't use [f]sync() if not necessary
  • Group timers across applications if possible (even systems)

Release Notes

In order to allow user to monitor the behaviour of their systems and to improve power consumption in general several improvements were done for Fedora 11:

  • Provide 2 new systemtap scripts to monitor disk and network activity of running applications
  • Add a workload framework package called BLTK to offer reproducible tests
  • Improved applications to reduce unecessary disk and/or network activity
  • Enabled several new features to save power:
    • relatime option for /
    • Automated start/stop of services related to hardware
    • Enable USB autosuspend for know working devices
    • Add optional tuned service to dynamically adapt system settings to the current use

User of Fedora 11 should therefore see a reduction in power usage of their system.

Comments and Discussion