summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVictor Lowther <victor.lowther@gmail.com>2008-06-29 12:07:22 -0500
committerVictor Lowther <victor.lowther@gmail.com>2010-06-05 13:32:49 -0500
commit2a09b333c3096cfb0d361a983a4c479c4d54ed09 (patch)
tree9439fe0d83efc2dc374a48e528a33fc8a7af4ddf
parent58379d77e02e7ed3e4d61757358fb88d7f98413a (diff)
More comments to the power hooks.
Also added an environment variable that will (hopefully) tell us what type of system we have.
-rw-r--r--pm/pm-functions.in6
-rw-r--r--pm/power.d/laptop-mode6
-rw-r--r--pm/power.d/readahead3
-rw-r--r--pm/power.d/xfs_buffer2
4 files changed, 16 insertions, 1 deletions
diff --git a/pm/pm-functions.in b/pm/pm-functions.in
index 9a25b10..4ae6fc6 100644
--- a/pm/pm-functions.in
+++ b/pm/pm-functions.in
@@ -85,6 +85,12 @@ done
. "${PM_FUNCTIONS}"
+if command_exists dmidecode; then
+ export CHASSIS_TYPE="$(dmidecode -s chassis-type)"
+else
+ export CHASSIS_TYPE=Unknown
+fi
+
# Simple little logging function.
# We do it this way because 'echo -n' is not posix.
log()
diff --git a/pm/power.d/laptop-mode b/pm/power.d/laptop-mode
index 52a8452..aae2335 100644
--- a/pm/power.d/laptop-mode
+++ b/pm/power.d/laptop-mode
@@ -2,7 +2,11 @@
VM="/proc/sys/vm"
-[ -f $VM/laptop_mode -a -f $VM/dirty_ratio ] || exit $NA
+[ -w $VM/laptop_mode -a -w $VM/dirty_ratio ] || exit $NA
+
+# We might only want to enable laptop mode on actual laptops.
+# It really depends on how green we want to try to make the Linux
+# world.
laptop_mode_ac() {
# disable laptop mode, set vm parameters back to sane defaults
diff --git a/pm/power.d/readahead b/pm/power.d/readahead
index c61ce43..3636909 100644
--- a/pm/power.d/readahead
+++ b/pm/power.d/readahead
@@ -2,6 +2,9 @@
[ -x /sbin/blockdev ] || exit $NA
+# more readahead = (hopefully) less hard drive activity.
+# less readahead = less trashing the page cache.
+
readahead() {
# the intent here is to iterate through all filesystems
# mounted on a local block device. It Works For The Maintainer(tm).
diff --git a/pm/power.d/xfs_buffer b/pm/power.d/xfs_buffer
index ec8a248..3d32ee4 100644
--- a/pm/power.d/xfs_buffer
+++ b/pm/power.d/xfs_buffer
@@ -5,6 +5,8 @@
XFS="/proc/sys/fs/xfs"
[ -f $XFS/age_buffer_centisecs ] || exit $NA
+# Why does XFS have its own parameters instead of just using the
+# VM subsystem ones? Only SGI knows...
xfs_ac() {
# don't buffer so much, flush data out regularly.