summaryrefslogtreecommitdiff
path: root/pm
diff options
context:
space:
mode:
authorVictor Lowther <victor.lowther@gmail.com>2008-06-29 11:42:16 -0500
committerVictor Lowther <victor.lowther@gmail.com>2010-06-05 13:32:49 -0500
commit69922741b43bfcee13677ae5dce16fa274f53a9e (patch)
treeb5d066c9d1daf9785d4c440d8bf63c1f39b96768 /pm
parentb58b6ef7c254bf46b0cfb909070bfb5028ac05ce (diff)
Rewrote the sched-powersave hook to eliminate redundancy.
Diffstat (limited to 'pm')
-rw-r--r--pm/power.d/sched-powersave39
1 files changed, 18 insertions, 21 deletions
diff --git a/pm/power.d/sched-powersave b/pm/power.d/sched-powersave
index 63e58d0..0bdb6ac 100644
--- a/pm/power.d/sched-powersave
+++ b/pm/power.d/sched-powersave
@@ -1,31 +1,28 @@
#!/bin/sh
-path_mc="/sys/devices/system/cpu/sched_mc_power_savings"
-path_smt="/sys/devices/system/cpu/sched_smt_power_savings"
-val=0
-
-case "$1" in
- true)
- echo "**sched policy powersave ON"
- val=1
- ;;
- false)
- echo "**sched policy powersave OFF"
- val=0
- ;;
-esac
-
# Based on the values (1-enable, 0-disable) for these controls,
# sched groups cpu power will be determined for different domains.
# When power savings policy is enabled and under light load conditions,
# scheduler will minimize the physical packages/cpu cores carrying the
# load and thus conserving power
-if [ -w "$path_mc" ] ; then
- echo $val > $path_mc
-fi
-if [ -w "$path_smt" ] ; then
- echo $val > $path_smt
-fi
+sched_powersave() {
+ for pool in mc smp ht; do
+ dev="$/sys/devices/system/cpu/sched_${pool}_power_savings"
+ [ -w "$dev" ] || continue
+ echo $1 > "$dev"
+ done
+}
+
+case "$1" in
+ true)
+ echo "**sched policy powersave ON"
+ sched_powersave 1
+ ;;
+ false)
+ echo "**sched policy powersave OFF"
+ sched_powersave 0
+ ;;
+esac
exit 0