Вчера завершил настройку энергосбережения на новом Lenovo thinkpad x220 4290rw1 с Ubuntu 11.04
Вот основной файл управления прозводительностью и энергосбережением.
#
# A script to agressively toggle power management between high
# performance and very low power usage.
# For more information on each of these options, see http://www.lesswatts.org
#
# To install:
#
# sudo apt-get install apmd pm-utils expect hdparm libnotify-bin
#
# Save this file to /usr/lib/pm-utils/power.d/99-savings.sh
# cd /usr/lib/pm-utils/power.d
# sudo install 99-savings.sh /etc/pm/sleep.d
# sudo install 99-savings.sh /etc/pm/power.d
#
# Ghanges history
# 31.08.2010 Testing Ubuntu 10.04. Small changes for Wi-Fi control
# 21.09.2010 Adding services control:
# evolution-alarm-notify,
# postfix,
# rsyslog
# 23.07.2011
VERSION=0.2
# for Ubintu 11.04 for Thinkpad x220 4290rw1
aUSB()
{
#################################################
## USB Subsystem
##
# 0.7-0.8 W
case "$1" in
false) #ac_power
for i in /sys/bus/usb/devices/*/power/control
do
echo "on" > $i
done
;;
true) #batt_power
for i in /sys/bus/usb/devices/*/power/control
do
echo "auto" > $i
done
for i in /sys/bus/usb/devices/*/power/autosuspend
do
echo 1 > $i
done
echo 1 > /sys/module/usbcore/parameters/autosuspend
;;
esac
}
aSATA()
{
case "$1" in
false) #ac_power
# Set the SATA to max performance
for i in /sys/class/scsi_host/host*/link_power_management_policy
do
echo max_performance > $i
done
;;
true) #batt_power
# Set SATA to minimum power
# 0.7 W
for i in /sys/class/scsi_host/host*/link_power_management_policy
do
echo min_power > $i
done
;;
esac
}
aPCI()
{
case "$1" in
false) #ac_power
for i in /sys/bus/pci/devices/*/power/control
do
echo on > $i
done
;;
true) #batt_power
for i in /sys/bus/pci/devices/*/power/control
do
echo auto > $i
done
;;
esac
}
aI2C()
{
case "$1" in
false) #ac_power
echo on > /sys/bus/i2c/devices/i2c-*/power/control
;;
true) #batt_power
echo auto > /sys/bus/i2c/devices/i2c-*/power/control
;;
esac
}
aHDD()
{
case "$1" in
false) #ac_power
# Set the drive to mostly stay awake. Some may want to change -B 200
# to -B 255 to avoid accumulating Load_Cycle_Counts
# -S 240 => put in standby after 20 minutes idle
# -B 200 => do not permit spindown
# -M => not supported by my drive
hdparm -B 200 -S 240 -M 254 /dev/sda
# Remount ext3/4 filesystems so the journal commit only happens every 60
# seconds. By default this is 5 but, I prefer to reduce the disk
# activity a bit.
mount -o remount,commit=60,atime /
;;
true) #batt_power
hdparm -B 1 -S 4 -M 128 /dev/sda
mount -o remount,noatime,commit=600 /
;;
esac
}
aSSD()
{
# add these commands in the /etc/rc.local
# echo deadline > /sys/block/sda/queue/scheduler
# echo 1 > /sys/block/sda/queue/iosched/fifo_batch
# sysctl -w vm.swappiness=1 # Strongly discourage swapping
# sysctl -w vm.vfs_cache_pressure=50 # Don't shrink the inode cache aggressively
case "$1" in
false) #ac_power
;;
true) #batt_power
;;
esac
}
aI915()
{
case "$1" in
false) #ac_power
echo 0 > /sys/module/i915/parameters/powersave
;;
true) #batt_power
echo 1 > /sys/module/i915/parameters/powersave
;;
esac
}
aWLAN()
{
# WiFi power savings.
case "$1" in
false) #ac_power
/sbin/iwconfig wlan0 power off txpower 14
;;
true) #batt_power
/sbin/iwconfig wlan0 power on txpower 4
;;
esac
}
aLAN()
{
case "$1" in
false) #ac_power
# set the ethernet max speed.
ethtool -s eth0 wol d
ethtool -s eth0 autoneg off speed 1000
;;
true) #batt_power
# set the ethernet power savings.
# ~ 0.4 W
ethtool -s eth0 wol d
ethtool -s eth0 autoneg off speed 100
;;
esac
}
aCPU()
{
#################################################
## CPU
##
case "$1" in
false) #ac_power
for i in /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor
do
echo ondemand > $i
done
# Shedule Multitreading
echo 0 > /sys/devices/system/cpu/sched_mc_power_savings
;;
true) #batt_power
for i in /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor
do
echo powersave > $i
done
# Shedule Multitreading
echo 1 > /sys/devices/system/cpu/sched_mc_power_savings
;;
esac
}
aSNDCARD()
{
case "$1" in
false) #ac_power
echo 0 > /sys/module/snd_hda_intel/parameters/power_save
;;
true) #batt_power
# Turn off sound card power savings
# < 0.1 W
echo 10 > /sys/module/snd_hda_intel/parameters/power_save
;;
esac
}
aBT()
{
case "$1" in
false) #ac_power
# Enable the bluetooth driver
echo enable > /proc/acpi/ibm/bluetooth
hciconfig hci0 up
;;
true) #batt_power
# Remove the bluetooth driver
# 0.3-0.4 W
hciconfig hci0 down
echo disable > /proc/acpi/ibm/bluetooth
;;
esac
}
aDAEMONS()
{
#################################################
## demons, services
##
case "$1" in
false) #ac_power
# evolution alarm and integrations
/usr/lib/evolution/2.32/evolution-alarm-notify &
#/usr/lib/evolution/e-calendar-factory &
#/usr/lib/evolution/e-addressbook-factory &
# starting Sendmail server
#postfix start
;;
true) #batt_power
# evolution alarm
killall evolution-alarm-notify
#killall e-calendar-factory
#killall e-addressbook-factory
# stopping Sendmail server
#postfix stop
;;
esac
}
# < 0.1 W
aWEBCAM()
{
case "$1" in
false) #ac_power
# Enable the webcam driver
modprobe uvcvideo
;;
true) #batt_power
# Remove the webcam driver
modprobe -r uvcvideo
;;
esac
}
aMEMORY()
{
case "$1" in
false) #ac_power
# Set kernel dirty page value back to default
echo 10 > /proc/sys/vm/dirty_ratio
echo 5 > /proc/sys/vm/dirty_background_ratio
# Only wakeup every 60 seconds to see if we need to write dirty pages
# By default this is every 5 seconds but, I prefer 60 to reduce disk
# activity.
echo 6000 > /proc/sys/vm/dirty_writeback_centisecs
;;
true) #batt_power
# Reduce disk activity by waiting up to 10 minutes before doing writes
echo 90 > /proc/sys/vm/dirty_ratio
echo 1 > /proc/sys/vm/dirty_background_ratio
echo 60000 > /proc/sys/vm/dirty_writeback_centisecs
;;
esac
}
aMISK()
{
case "$1" in
false) #ac_power
# Turn off the laptop mode disk optimization
echo 0 > /proc/sys/vm/laptop_mode
echo tsc > /sys/devices/system/clocksource/clocksource0/current_clocksource
# enable logging
service rsyslog start
# ZiXEL nbg460n. Set maximum wifi speed
if [ -f /etc/pm/802.11.bgn ]; then /etc/pm/802.11.bgn 1; fi
# enable winbindd
if [ -f /etc/init.d/winbind ]; then /etc/init.d/winbind start; fi
# Setup maximum brigthness
# Thinkpad x220, Ubuntu 11.04
echo 15 > /sys/devices/virtual/backlight/acpi_video0/brightness
# Thinkpad x200, Ubuntu 10.04
#echo 100 > /proc/acpi/video/VID/LCD0/brightness
# Powersave pci express
echo performance > /sys/module/pcie_aspm/parameters/policy
;;
true) #batt_power
# Set laptop disk write mode
echo 5 > /proc/sys/vm/laptop_mode
echo hpet > /sys/devices/system/clocksource/clocksource0/current_clocksource
# disable logging
service rsyslog stop
# ZiXEL nbg460n. Set standard wifi speed
if [ -f /etc/pm/802.11.bgn ]; then /etc/pm/802.11.bgn 0; fi
# disable winbind
if [ -f /etc/init.d/winbind ]; then /etc/init.d/winbind stop ; fi
# Setup brigthness 30%
echo 8 > /sys/devices/virtual/backlight/acpi_video0/brightness
#echo 30 > /proc/acpi/video/VID/LCD0/brightness
echo powersave > /sys/module/pcie_aspm/parameters/policy
;;
esac
}
aNOTIFY()
{
case "$1" in
false) #ac_power
ICON="ac-adapter"
;;
true) #battery_power
ICON="battery"
;;
esac
USER=`ps -C gnome-session -o user=` #find UID user who start gnome-session
PIDS=`pgrep -u $user gnome-session` #find PID
for PID in $PIDS; do
DBUS_SESSION_BUS_ADDRESS=$(grep -z DBUS_SESSION_BUS_ADDRESS /proc/$PID/environ \
| sed -e 's/DBUS_SESSION_BUS_ADDRESS=//')
DBUS_SESSION_BUS_ADDRESS=$DBUS_SESSION_BUS_ADDRESS notify-send 'AC' 'Maximum Performance Mode' -i $ICON
done
}
##########################################################
## Apply settings
##
aCPU $1
aUSB $1
aI2C $1
aSATA $1
aPCI $1
if [ $(hdparm -i /dev/sda | grep Model | awk '{print substr($2,1,3)}') == "SSD" ];
then
aSSD $1
else
aHDD $1
fi
aI915 $1
aWLAN $1
aLAN $1
aSNDCARD $1
aBT $1
aWEBCAM $1
aMEMORY $1
aDAEMONS $1
aMISK $1
aNOTIFY $1
На 4-х ядерном ноуте потребление снижается примерно на 5-6 Вт.
Результат получился лучше чем в Windows 7.
Полностью статья по настройке энергосбережения на Lenovo Thinkpad X в моем блоге:
http://axa-ru.blogspot.com/2009/07/thinpad-x200s.html