2013年10月6日星期日

Power saving on MacBook Pro runs Fedora 19

Lots of people are questioning running Fedora (or other Linux distributions) on MacBook Pro with the following reasons:

  1. programs runs faster on OS X
  2. OS X lasts longer with battery
  3. OS X is prettier
This blog post is about #2. (I will write more posts to prove #1 and #3 is wrong).

My macbook lasts up to 7 hours after a number of energy saving changes on Fedora 19, and you will know more about linux power management after these tweaks.

General

One principle is disabling anything that you don't need:
  • disable keyboard backlight: Just press the F5 key.
  • reduce screen light: Just press F1 key until it's acceptable. (The dynamic light adjustment from OS X is unsupported yet)
  • disable bluetooth when you don't use it: Just switch it off on the bluetooth icon to the top right corner
One question dwells for a while is how to disable the backlight of the big apple logo to the back of screen, please comment if anyone know how.

Daemons

you should disable all unused runtime services that you don't need. For example, bluetooth daemon, printer service, colord, etc. use this command to list all running services:

sudo systemctl list-units | grep running

For example, I hardly use services like LVM management, Libvirt daemon, mDNS, bluetooth, so I use this command to disable them all:

for serv in "lvm2-lvmetad.service bluetooth.service libvirtd.service avahi-daemon.service"; do
sudo systemctl stop $serv
done

it also works for OS performance boost because it also reduces number of running processes.

Devices

I didn't know macbook devices consumes lots of energy under Fedora default installation until using a tool named powertop. you can run powertop with sudo and it provides lots of useful information. Some simple truth are:

  • the hardware audio codec is always on
  • USB devices are not auto suspend.
  • all PCI devices are always on 

You can apply all options from Bad to Good under the Tunnable tab. If you want to persist these options, find all configuration in kernel and system level from the /proc and /sys filesystem by running:

sudo powerstop --html

Then it will generate a file named powertop.html, all the configuration of tunning can be found from section "Software Settings in need of Tunning".

USB autosuspend

Apply this kernel parameter to your kernel in grub:

usbcore.autosuspend=5

Disk

MacBook SSD differs from hard disk which means spindown doesn't work. One tip is make the disk I/O flush triggered less frequently. Here the freqency is 5 seconds:

echo "5" > /proc/sys/vm/laptop_mode

Reference

2 条评论:

Unknown 说...

cool <a href="http://www.hnlonger.com/>Macintosh</a>

朱可 说...

Compare to the OSX energy saving, I should investigate more details for linux on macbook