From 2a09b333c3096cfb0d361a983a4c479c4d54ed09 Mon Sep 17 00:00:00 2001 From: Victor Lowther Date: Sun, 29 Jun 2008 12:07:22 -0500 Subject: More comments to the power hooks. Also added an environment variable that will (hopefully) tell us what type of system we have. --- pm/pm-functions.in | 6 ++++++ pm/power.d/laptop-mode | 6 +++++- pm/power.d/readahead | 3 +++ pm/power.d/xfs_buffer | 2 ++ 4 files changed, 16 insertions(+), 1 deletion(-) (limited to 'pm') 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. -- cgit v1.2.3