Saturday, April 23, 2011

Power management boost on Linux Mint 10 / Ubuntu 10.10

So, I've been a performance instead of battery saving fan since I got my first laptop. It usually worked out by selecting "Performance" from some specific vendor power management software on Windows. But with Linux, it was getting annoying. I had my Asus EEEPC 1008HA for almost 2 years now, and I was really annoyed by being forced to get power plugged because otherwise, my music stopped playing correctly, had some small interruptions, videos, the same..even compiz had small interruptions in compositing my desktop the way I like it. It was clear to me that it was a power management, and surely something related to hard drive power management. After digging up the internet, I've seen using hdparm command, that a HDD parameter it was changing automatically between power on/off - APM_level, when power plug on, it was set to 254, when power plug disconnected, it was 128. After that, I've searched Google for details and scripts that can make my EEEPC run the same on battery and power and I got the following script up and running, and my laptop run as fast as on power plug connected. If anyone intends to use this, this will drain your battery much faster than using other power management software.
###power save off
echo performance > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
echo performance > /sys/devices/system/cpu/cpu1/cpufreq/scaling_governor
hdparm -B 254 /dev/sda
echo 0 > /proc/sys/vm/laptop_mode
echo max_performance > /sys/class/scsi_host/host0/link_power_management_policy
echo max_performance > /sys/class/scsi_host/host1/link_power_management_policy
echo max_performance > /sys/class/scsi_host/host2/link_power_management_policy
echo max_performance > /sys/class/scsi_host/host3/link_power_management_policy
iwconfig wlan0 power off
echo 0 > /sys/module/snd_hda_intel/parameters/power_save
echo 10 > /proc/sys/vm/dirty_ratio
echo 5 > /proc/sys/vm/dirty_background_ratio
echo 1000 > /proc/sys/vm/dirty_writeback_centisecs
This will practically remove any power management or set to maximum performance for SATA, CPU, HDD, wireless and sound. And, I've put this into my /etc/rc.local file, and after a restart, everything is the same, ..well, except for the dimmed light, which I don't mind if it helps some power save. It's ok though, before this, my battery lasted around 2 hours with interruptions ..now it lasts for an hour, but seamless performance.

No comments:

Post a Comment