- Updates to the ktune scripts
- Added support for start/stop of the ktune scripts and ktune initscript
This commit is contained in:
parent
d4938a7800
commit
ed3e6634f2
6 changed files with 310 additions and 51 deletions
|
|
@ -30,6 +30,8 @@ KERNEL_ELEVATOR="cfq"
|
|||
CMDLINE_ELEVATOR=$?
|
||||
SYS_BLOCK_SDX=$(eval LANG=C /bin/ls -1 ${ELEVATOR_TUNE_DEVS} 2>/dev/null)
|
||||
|
||||
CMDLINE_ARG1=$1
|
||||
|
||||
declare -a KTUNE_FILES
|
||||
if [ -r "$SYSCTL" ]; then
|
||||
KTUNE_FILES[0]="$SYSCTL"
|
||||
|
|
@ -85,7 +87,7 @@ call_script() {
|
|||
|
||||
if [ -x "$script" ]; then
|
||||
echo -n "Calling "$script": "
|
||||
("$script")
|
||||
("$script ${CMDLINE_ARG1}")
|
||||
ret=$?
|
||||
|
||||
if [ $ret -eq 0 ]; then
|
||||
|
|
|
|||
|
|
@ -3,12 +3,72 @@
|
|||
ALPM="medium_power"
|
||||
|
||||
# Set ALPM for all host adapters that support it
|
||||
set_alpm() {
|
||||
for x in /sys/bus/scsi/devices/host*/scsi_host/host*/; do
|
||||
hotplug="0"
|
||||
if [ -e $x/sata_hotplug ]; then
|
||||
hotplug="$(cat $x/sata_hotplug)"
|
||||
fi
|
||||
if [ "$hotplug" == "0" -a -e $x/link_power_management_policy ]; then
|
||||
echo $ALPM > $x/link_power_management_policy
|
||||
echo $1 > $x/link_power_management_policy
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
start() {
|
||||
set_alpm ${ALPM}
|
||||
return 0
|
||||
}
|
||||
|
||||
# Disable ALPM for all host adapters that support it
|
||||
stop() {
|
||||
set_alpm "max_power"
|
||||
return 0
|
||||
}
|
||||
|
||||
# Reload it, just start once more
|
||||
reload() {
|
||||
start
|
||||
}
|
||||
|
||||
# Status
|
||||
status() {
|
||||
return 0
|
||||
}
|
||||
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
[ -f "$VAR_SUBSYS_KTUNE" ] && exit 0
|
||||
start
|
||||
RETVAL=$?
|
||||
;;
|
||||
stop)
|
||||
[ -f "$VAR_SUBSYS_KTUNE" ] || exit 0
|
||||
stop
|
||||
RETVAL=$?
|
||||
;;
|
||||
reload)
|
||||
[ -f "$VAR_SUBSYS_KTUNE" ] && reload
|
||||
RETVAL=$?
|
||||
;;
|
||||
restart|force-reload)
|
||||
[ -f "$VAR_SUBSYS_KTUNE" ] && stop
|
||||
start
|
||||
RETVAL=$?
|
||||
;;
|
||||
condrestart|try-restart)
|
||||
[ -f "$VAR_SUBSYS_KTUNE" ] || exit 0
|
||||
stop
|
||||
start
|
||||
RETVAL=$?
|
||||
;;
|
||||
status)
|
||||
status
|
||||
RETVAL=$?
|
||||
;;
|
||||
*)
|
||||
echo $"Usage: $0 {start|stop|restart|condrestart|status}"
|
||||
RETVAL=2
|
||||
;;
|
||||
esac
|
||||
|
|
|
|||
|
|
@ -3,12 +3,72 @@
|
|||
ALPM="medium_power"
|
||||
|
||||
# Set ALPM for all host adapters that support it
|
||||
set_alpm() {
|
||||
for x in /sys/bus/scsi/devices/host*/scsi_host/host*/; do
|
||||
hotplug="0"
|
||||
if [ -e $x/sata_hotplug ]; then
|
||||
hotplug="$(cat $x/sata_hotplug)"
|
||||
fi
|
||||
if [ "$hotplug" == "0" -a -e $x/link_power_management_policy ]; then
|
||||
echo $ALPM > $x/link_power_management_policy
|
||||
echo $1 > $x/link_power_management_policy
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
start() {
|
||||
set_alpm ${ALPM}
|
||||
return 0
|
||||
}
|
||||
|
||||
# Disable ALPM for all host adapters that support it
|
||||
stop() {
|
||||
set_alpm "max_power"
|
||||
return 0
|
||||
}
|
||||
|
||||
# Reload it, just start once more
|
||||
reload() {
|
||||
start
|
||||
}
|
||||
|
||||
# Status
|
||||
status() {
|
||||
return 0
|
||||
}
|
||||
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
[ -f "$VAR_SUBSYS_KTUNE" ] && exit 0
|
||||
start
|
||||
RETVAL=$?
|
||||
;;
|
||||
stop)
|
||||
[ -f "$VAR_SUBSYS_KTUNE" ] || exit 0
|
||||
stop
|
||||
RETVAL=$?
|
||||
;;
|
||||
reload)
|
||||
[ -f "$VAR_SUBSYS_KTUNE" ] && reload
|
||||
RETVAL=$?
|
||||
;;
|
||||
restart|force-reload)
|
||||
[ -f "$VAR_SUBSYS_KTUNE" ] && stop
|
||||
start
|
||||
RETVAL=$?
|
||||
;;
|
||||
condrestart|try-restart)
|
||||
[ -f "$VAR_SUBSYS_KTUNE" ] || exit 0
|
||||
stop
|
||||
start
|
||||
RETVAL=$?
|
||||
;;
|
||||
status)
|
||||
status
|
||||
RETVAL=$?
|
||||
;;
|
||||
*)
|
||||
echo $"Usage: $0 {start|stop|restart|condrestart|status}"
|
||||
RETVAL=2
|
||||
;;
|
||||
esac
|
||||
|
|
|
|||
|
|
@ -2,16 +2,21 @@
|
|||
|
||||
ALPM="min_power"
|
||||
|
||||
# Set ALPM for all host adapters that support it
|
||||
set_alpm() {
|
||||
for x in /sys/bus/scsi/devices/host*/scsi_host/host*/; do
|
||||
hotplug="0"
|
||||
if [ -e $x/sata_hotplug ]; then
|
||||
hotplug="$(cat $x/sata_hotplug)"
|
||||
fi
|
||||
if [ "$hotplug" == "0" -a -e $x/link_power_management_policy ]; then
|
||||
echo $ALPM > $x/link_power_management_policy
|
||||
echo $1 > $x/link_power_management_policy
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
start() {
|
||||
# Set ALPM for all host adapters that support it
|
||||
set_alpm ${ALPM}
|
||||
|
||||
# Enables USB autosuspend for all devices
|
||||
for i in /sys/bus/usb/devices/*/power/autosuspend; do echo 1 > $i; done
|
||||
|
|
@ -30,3 +35,71 @@ for i in /dev/scd*; do hal-disable-polling --device $i; done
|
|||
|
||||
# Enable power saving mode for Wi-Fi cards
|
||||
for i in /sys/bus/pci/devices/*/power_level ; do echo 5 > $i ; done
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
stop() {
|
||||
set_alpm "max_power"
|
||||
|
||||
# Disables USB autosuspend for all devices
|
||||
for i in /sys/bus/usb/devices/*/power/autosuspend; do echo 0 > $i; done
|
||||
|
||||
# Disables multi core power savings for low wakeup systems
|
||||
[ -e /sys/devices/system/cpu/sched_mc_power_savings ] && echo 0 > /sys/devices/system/cpu/sched_mc_power_savings
|
||||
|
||||
# Enable ondemand governor (best for powersaving)
|
||||
[ -e /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor ] && echo ondemand > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
|
||||
|
||||
# Enable AC97 audio power saving
|
||||
[ -e /sys/module/snd_ac97_codec/parameters/power_save ] && echo Y > /sys/module/snd_ac97_codec/parameters/power_save
|
||||
|
||||
# Reset power saving mode for Wi-Fi cards
|
||||
for i in /sys/bus/pci/devices/*/power_level ; do echo 0 > $i ; done
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
reload() {
|
||||
start
|
||||
}
|
||||
|
||||
status() {
|
||||
return 0
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
[ -f "$VAR_SUBSYS_KTUNE" ] && exit 0
|
||||
start
|
||||
RETVAL=$?
|
||||
;;
|
||||
stop)
|
||||
[ -f "$VAR_SUBSYS_KTUNE" ] || exit 0
|
||||
stop
|
||||
RETVAL=$?
|
||||
;;
|
||||
reload)
|
||||
[ -f "$VAR_SUBSYS_KTUNE" ] && reload
|
||||
RETVAL=$?
|
||||
;;
|
||||
restart|force-reload)
|
||||
[ -f "$VAR_SUBSYS_KTUNE" ] && stop
|
||||
start
|
||||
RETVAL=$?
|
||||
;;
|
||||
condrestart|try-restart)
|
||||
[ -f "$VAR_SUBSYS_KTUNE" ] || exit 0
|
||||
stop
|
||||
start
|
||||
RETVAL=$?
|
||||
;;
|
||||
status)
|
||||
status
|
||||
RETVAL=$?
|
||||
;;
|
||||
*)
|
||||
echo $"Usage: $0 {start|stop|restart|condrestart|status}"
|
||||
RETVAL=2
|
||||
;;
|
||||
esac
|
||||
|
|
|
|||
|
|
@ -3,12 +3,72 @@
|
|||
ALPM="medium_power"
|
||||
|
||||
# Set ALPM for all host adapters that support it
|
||||
set_alpm() {
|
||||
for x in /sys/bus/scsi/devices/host*/scsi_host/host*/; do
|
||||
hotplug="0"
|
||||
if [ -e $x/sata_hotplug ]; then
|
||||
hotplug="$(cat $x/sata_hotplug)"
|
||||
fi
|
||||
if [ "$hotplug" == "0" -a -e $x/link_power_management_policy ]; then
|
||||
echo $ALPM > $x/link_power_management_policy
|
||||
echo $1 > $x/link_power_management_policy
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
start() {
|
||||
set_alpm ${ALPM}
|
||||
return 0
|
||||
}
|
||||
|
||||
# Disable ALPM for all host adapters that support it
|
||||
stop() {
|
||||
set_alpm "max_power"
|
||||
return 0
|
||||
}
|
||||
|
||||
# Reload it, just start once more
|
||||
reload() {
|
||||
start
|
||||
}
|
||||
|
||||
# Status
|
||||
status() {
|
||||
return 0
|
||||
}
|
||||
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
[ -f "$VAR_SUBSYS_KTUNE" ] && exit 0
|
||||
start
|
||||
RETVAL=$?
|
||||
;;
|
||||
stop)
|
||||
[ -f "$VAR_SUBSYS_KTUNE" ] || exit 0
|
||||
stop
|
||||
RETVAL=$?
|
||||
;;
|
||||
reload)
|
||||
[ -f "$VAR_SUBSYS_KTUNE" ] && reload
|
||||
RETVAL=$?
|
||||
;;
|
||||
restart|force-reload)
|
||||
[ -f "$VAR_SUBSYS_KTUNE" ] && stop
|
||||
start
|
||||
RETVAL=$?
|
||||
;;
|
||||
condrestart|try-restart)
|
||||
[ -f "$VAR_SUBSYS_KTUNE" ] || exit 0
|
||||
stop
|
||||
start
|
||||
RETVAL=$?
|
||||
;;
|
||||
status)
|
||||
status
|
||||
RETVAL=$?
|
||||
;;
|
||||
*)
|
||||
echo $"Usage: $0 {start|stop|restart|condrestart|status}"
|
||||
RETVAL=2
|
||||
;;
|
||||
esac
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
Summary: A dynamic adaptive system tuning daemon
|
||||
Name: tuned
|
||||
Version: 0.2.1
|
||||
Version: 0.2.2
|
||||
Release: 1%{?dist}
|
||||
License: GPLv2+
|
||||
Group: System Environment/Daemons
|
||||
|
|
@ -96,6 +96,10 @@ fi
|
|||
|
||||
|
||||
%changelog
|
||||
* Fri Aug 14 2009 Phil Knirsch <pknirsch@redhat.com> 0.2.2-1
|
||||
- Updates to the ktune scripts
|
||||
- Added support for start/stop of the ktune scripts and ktune initscript
|
||||
|
||||
* Tue Aug 04 2009 Phil Knirsch <pknirsch@redhat.com> - 0.2.1-1
|
||||
- Added first set of profiles
|
||||
- Added tuned-adm tool for profile switching
|
||||
|
|
|
|||
Loading…
Reference in a new issue