Sign in to follow this  
Followers 0

How To: Power saving with pm-utils

1 post in this topic

Posted

I've noticed a lot of distros really don't include many (or any) laptop power management tweaks by default. The only distro that seems to try to do this is ubuntu 12.04, which already does some of the stuff in this how to. When I recently ran powertop on my fedora 17 install and it reported relatively high battery discharge, and all the tunables were shown as "bad" I decided to use the same tweaks I had on my arch linux install, using pm-utils scripts. There are other ways to do this, such as laptop-mode-tools and jupiter, but I've had the best success with the following:

Note, that some of these scripts have varying levels of success on different hardware, you may want to look at them and tweak them a little bit if need be, or remove ones that don't work for you (for example, I found the pm-utils 'harddrive' script to be too aggresive for my taste, so I increased the battery APM to 128 and the spindown time to 3 minutes, which are the default settings ubuntu 12.04 uses). You can view the following log to see if the scripts are executing properly:

cat /var/log/pm-powersave.log
Download the upstream pm-utils source from here: http://pm-utils.freedesktop.org/rele...s-1.4.1.tar.gz Once extracted you can find various power saving scripts in: pm-utils-1.4.1/pm/power.d. Take the scripts you wish to use, and drop them into /etc/pm/power.d and make them executable. This will enable a good amount of the powertop recommended tunables automatically when you are on battery. Note: your distro may or may not already have some of the above scripts located in /usr/lib64/pm-utils/power.d or /usr/lib/pm-utils/power.d Ubuntu does include and use some of these by default, but fedora didn't include any. After doing this I did a few additonal things that didn't come with the included scripts, to get the remaining powertop recommendations set to 'good'. I added a script called "device_pm" (Using a script I found on the arch forums: https://bbs.archlinu....php?pid=860231). to enable runtime pm for all my pci devices:

#!/bin/sh


device_pm() {

	for dpcontrol in /sys/bus/{pci,spi,i2c}/devices/*/power/control; do

		[ -w "$dpcontrol" ] || continue

		echo $1 > "$dpcontrol"

	done

}


case "$1" in

	true)

		echo "**device power management ON"

		device_pm auto

		;;

	false)

		echo "**device power management OFF"

		device_pm on

		;;

esac


exit 0
I added a script called usb_pm (taken from the arch wiki: https://wiki.archlin...-utils_Settings) to enable usb autosuspend and disable nmi_watchdog:

#!/bin/sh

case "$1" in

	true)

	   # USB powersaving

		for i in /sys/bus/usb/devices/*/power/autosuspend; do

			echo 1 > $i

		done

		for i in /sys/bus/usb/devices/*/power/control; do

			echo auto > $i

		done

	sysctl kernel.nmi_watchdog=0

	;;

	false)

		for i in /sys/bus/usb/devices/*/power/autosuspend; do

			echo 2 > $i

		done

		for i in /sys/bus/usb/devices/*/power/control; do

			echo on > $i

		done

	sysctl kernel.nmi_watchdog=1

	;;

esac


exit 0
I added a simpler script for intel audio power saving (taken from a script on the crunchbang forums: http://crunchbanglin...ipt-for-debian/) that worked better on my machine than the pm-utils one:

#!/bin/sh

# A script to enable intel audio power saving on fedora


case "$1" in

	true)

	# Enable some power saving settings while on battery

	   # Intel power saving

		echo Y > /sys/module/snd_hda_intel/parameters/power_save_controller

		echo 1 > /sys/module/snd_hda_intel/parameters/power_save

	;;

	false)

	   #Return settings to default on AC power

		echo N > /sys/module/snd_hda_intel/parameters/power_save_controller

		echo 0 > /sys/module/snd_hda_intel/parameters/power_save

	;;

esac


exit 0
and lastly, increase the vm_writeback value on battery (taken from arch wiki: https://wiki.archlin...-utils_Settings)

#!/bin/sh

case "$1" in

	true)

	   # Less VM disk activity. Suggested by powertop

		echo 1500 > /proc/sys/vm/dirty_writeback_centisecs

	;;

	false)

	   #Return settings to default on AC power

		echo 500 > /proc/sys/vm/dirty_writeback_centisecs

	;;

esac


exit 0

And here are the results smile.gif

http://i.imgur.com/ZLXQw.png

http://i.imgur.com/GzFPI.jpg

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0

  • Recently Browsing   0 members

    No registered users viewing this page.