Updated - ready for publish

This commit is contained in:
davidrl 2003-07-30 08:34:50 +00:00
parent 6fea9079de
commit 3d68971348
1 changed files with 469 additions and 213 deletions

View File

@ -13,22 +13,22 @@
<revhistory>
<revision>
<revnumber>2.3</revnumber>
<date>2003-06-29</date>
<revnumber>2.31</revnumber>
<date>2003-07-30</date>
<authorinitials>drl</authorinitials>
<revremark>Updated document content and structure</revremark>
<revremark>Minor updates</revremark>
</revision>
<revision>
<revnumber>2.0</revnumber>
<date>2002-10-08</date>
<authorinitials>drl</authorinitials>
<revremark>Major updates and conversion to DocBook SGML</revremark>
<revremark>Major updates and conversion to SGML</revremark>
</revision>
<revision>
<revnumber>1.0</revnumber>
<date>1997-12-21</date>
<authorinitials>hm</authorinitials>
<revremark>Initial draft by Hanno Muller &lt;kontakt@hanno.de&gt;</revremark>
<revremark>Initial draft by Hanno Muller</revremark>
</revision>
</revhistory>
@ -48,7 +48,8 @@ different types of batteries available.</para>
Advanced Power Management (APM) or Advanced Configuration and Power Interface
(ACPI). ACPI is the newer of the two technologies and puts power management in
the hands of the operating system, allowing for more intelligent power
management than is possible with BIOS controlled APM. This is most useful for battery-powered laptops.
management than is possible with BIOS controlled APM. This is most useful for
battery-powered laptops.
You can only have one
power management interface in control of your machine at a time, so it's
important you decide which method best suits your situation.</para>
@ -58,68 +59,123 @@ important you decide which method best suits your situation.</para>
<para><emphasis>Advanced Power Management (APM)</emphasis>
allows your computer's BIOS to control your system's power management
without the knowledge of the operating system.
The advantages to APM under Linux are that it's stable, well supported by Linux vendors and has a solid history behind it.
However, not much development has been done with it over the past few years.</para>
The advantages to APM under Linux are that it's stable, well supported by
Linux vendors and has a solid history behind it.
However, not much development has been done with it over the past few
years.</para>
<para>To use it, you'll need to enable APM in the kernel. Most of the other APM
options exist as work-arounds for known problems with specific hardware devices,
<para>To use it, you'll need to enable APM in the kernel:</para>
<screen>
[*] Power Management support
&lt;*&gt; Advanced Power Management BIOS support
[ ] Ignore USER SUSPEND (NEW)
[ ] Enable PM at boot time (NEW)
[ ] Make CPU Idle calls when idle (NEW)
[ ] Enable console blanking using APM (NEW)
[ ] RTC stores time in GMT (NEW)
[ ] Allow interrupts during APM BIOS calls (NEW)
[ ] Use real mode APM BIOS call to power off (NEW)
</screen>
<para>
Most of the other APM
options exist as work-arounds for known problems with specific hardware
devices,
so you'll probably only want to enable the first one (CONFIG_APM).</para>
<itemizedlist>
<listitem><para>Advanced Power Management BIOS support (CONFIG_APM):
You'll need to enable this in order to do anything useful
with APM. User-space programs will receive notification of
APM events (e.g., battery status change) and a /proc/apm
device will provide you with battery status information.</para></listitem>
You'll need to enable this in order to do anything
useful
with APM. User-space programs will receive
notification of
APM events (e.g., battery status change) and a
/proc/apm
device will provide you with battery status
information.</para></listitem>
<listitem><para>Ignore USER SUSPEND (CONFIG_APM_IGNORE_USER_SUSPEND):
This is a workaround for NEC Versa M notebooks.</para></listitem>
This is a workaround for NEC Versa M
notebooks.</para></listitem>
<listitem><para>Enable PM at boot time (CONFIG_APM_DO_ENABLE):
Although it sounds nifty, most machines do
not require this feature to be enabled and in fact can hang
not require this feature to be enabled and in fact can
hang
some systems at boot time.</para></listitem>
<listitem><para>Make CPU Idle calls when idle (CONFIG_APM_CPU_IDLE): On some machines,
this option provides increased power savings. On others, it will
hang the system at boot time. Use with caution.</para></listitem>
<listitem><para>Enable console blanking using APM (CONFIG_APM_DISPLAY_BLANK):
Instead of blanking the virtual console actually turn off the
screen. This won't work with X-Windows and actually can cause more
<listitem><para>Make CPU Idle calls when idle (CONFIG_APM_CPU_IDLE):
On some machines,
this option provides increased power savings. On
others, it will
hang the system at boot time. Use with
caution.</para></listitem>
<listitem><para>Enable console blanking using APM
(CONFIG_APM_DISPLAY_BLANK):
Instead of blanking the virtual console actually turn
off the
screen. This won't work with X-Windows and actually
can cause more
problems that it solves.</para></listitem>
<listitem><para>RTC stores time in GMT (CONFIG_APM_RTC_IS_GMT): If you want to
store GMT (Greenwich Mean Time) in your RTC (Real Time Clock),
<listitem><para>RTC stores time in GMT (CONFIG_APM_RTC_IS_GMT): If you
want to
store GMT (Greenwich Mean Time) in your RTC (Real Time
Clock),
say yes here.</para></listitem>
<listitem><para>Allow interrupts during APM BIOS calls (CONFIG_APM_ALLOW_INTS):
This is a workaround for some IBM Thinkpads that hang while
<listitem><para>Allow interrupts during APM BIOS calls
(CONFIG_APM_ALLOW_INTS):
This is a workaround for some IBM Thinkpads that hang
while
suspending.</para></listitem>
<listitem><para>Use real mode APM BIOS call to power off (CONFIG_APM_REAL_MODE_POWER_OFF):
This is a workaround for a number of broken BIOSes. If your computer
crashes instead of powering off properly, turn this on.</para></listitem></itemizedlist>
<listitem><para>Use real mode APM BIOS call to power off
(CONFIG_APM_REAL_MODE_POWER_OFF):
This is a workaround for a number of broken BIOSes.
If your computer
crashes instead of powering off properly, turn this
on.</para></listitem></itemizedlist>
<para>You'll want to install the APM daemon from
<ulink url="http://www.worldvisions.ca/~apenwarr/apmd/">http://www.worldvisions.ca/~apenwarr/apmd/</ulink>
and configure your system startup scripts to activate it on boot:</para>
<screen>
# Start the APM daemon if APM is enabled in the kernel
# Start the APM daemon if it exists and if APM is enabled in the kernel
if [ -x /usr/sbin/apmd -a -d /proc/apm ]; then
if cat /proc/apm 1> /dev/null 2> /dev/null ; then
echo "Starting APM daemon: /usr/sbin/apmd"
/usr/sbin/apmd
fi
fi
</screen>
<para>The APM daemon is actually made up of three primary programs:</para>
<itemizedlist>
<listitem><para><command>apmd</command> - handles power management tasks</para></listitem>
<listitem><para><command>apm</command> - a command-line tool to print the current battery status or suspend the computer</para></listitem>
<listitem><para><command>xapm</command> - a simple battery meter for X</para></listitem>
<listitem><para><command>apmd</command> - handles power management
tasks</para></listitem>
<listitem><para><command>apm</command> - a command-line tool to print
the current battery status or suspend the computer</para></listitem>
<listitem><para><command>xapm</command> - a simple battery meter for
X</para></listitem>
</itemizedlist>
<para>If you're looking for a simple, "works out of the box" approach to power
management for your Laptop, APM is definitely the way to go.</para>
<para>A simple script to notify you how much battery time is remaining can be
added to your <filename>~/.profile</filename> file:</para>
<screen>
if [ -f /proc/apm ]; then
DUMMY=`cat /proc/apm | cut -d" " -f 7`
# Don't display when fully charged
if [ "$DUMMY" != "99%" ]; then
LEVEL=`cat /proc/apm | sed -e "s/^.*% //"`
echo "Battery at $DUMMY ($LEVEL)"
fi
fi
</screen>
</sect2>
<sect2 id="acpi">
@ -127,41 +183,62 @@ management for your Laptop, APM is definitely the way to go.</para>
<para><emphasis>Advanced Configuration and Power Interface (ACPI)</emphasis>
is the successor to APM, which places the responsibility of power management
away from the BIOS and into the hands of the operating system.
ACPI Linux is newer than APM Linux, more flexible in responding to power management events, has seen
much more development as of late, and as a result of all this is prone to its own share of bugs from
ACPI Linux is newer than APM Linux, more flexible in responding to power
management events, has seen
much more development as of late, and as a result of all this is prone to its
own share of bugs from
time to time.</para>
<para>If you're into cutting-edge development and are not intimidated with kernel
builds and applying patches against source code, ACPI is worth consideration.</para>
<para>If you're into cutting-edge development and are not intimidated with
kernel
builds and applying patches against source code, ACPI is worth
consideration.</para>
<para>There are two parts to ACPI under Linux: The ACPI driver built into the
kernel itself, and the ACPI daemon (ACPID). ACPID in its current incarnation is
kernel itself, and the ACPI daemon (ACPID). ACPID in its current incarnation
is
pretty simple: monitor /proc/acpi/event and do things in response. Even if
you don't load the daemon, you'll still get the benefit of ACPI features built
into the kernel such as processor thermal support.</para>
<para>You can determine which version
of the ACPI driver you are using, along with supported suspend states, by using:</para>
of the ACPI driver you are using, along with supported suspend states, by
using:</para>
<screen>
bash $ cat /proc/acpi/info
version: 20030619
states: S0 S1 S3 S4 S4Bios S5
states: S0 S1 S3 S4 S4 S5
</screen>
<para>ACPI development is progressing at a steady rate, so you might want to consider
<para>ACPI development is progressing at a steady rate, so you might want to
consider
<ulink url="http://sourceforge.net/project/showfiles.php?group_id=36832">patching</ulink>
your kernel against any recent updates to the kernel-level ACPI code. Once you have downloaded the
your kernel against any recent updates to the kernel-level ACPI code. Once
you have downloaded the
patch for your specific kernel, you can patch it with something like:</para>
<screen>
bash$ gunzip acpi-[version]-[kernel].diff.gz
bash# mv acpi-[version]-[kernel].diff /usr/src/linux-[version]
bash$ gunzip acpi-[version-kernel].diff.gz
bash# cd /usr/src/linux-[version]
bash# patch -p1 < acpi-[version]-[kernel].diff
bash# patch -Np1 -i ../acpi-[version-kernel].diff
</screen>
<para>You'll want to recompile your kernel after this, of course.</para>
<para>You'll want to recompile your kernel after this, of course:</para>
<screen>
[*] ACPI Support
[ ] CPU Enumeration Only
&lt;*&gt; AC Adapter
&lt;*&gt; Battery
&lt;*&gt; Button
&lt;*&gt; Fan
&lt;*&gt; Processor
&lt;*&gt; Thermal Zone
&lt; &gt; ASUS Laptop Extras
&lt; &gt; Toshiba Laptop Extras
[*] Debug Statements
</screen>
<para>You'll also want to install the ACPID daemon from
<ulink url="http://sourceforge.net/project/showfiles.php?group_id=33140">http://sourceforge.net/project/showfiles.php?group_id=33140</ulink>
@ -174,7 +251,8 @@ if [ -x /usr/sbin/acpid -a -d /proc/acpi ]; then
fi
</screen>
<para>A bit of history... Microsoft was the first vendor to implement ACPI. This is both good and
<para>A bit of history... Microsoft was the first vendor to implement ACPI.
This is both good and
bad. It is good because when you buy a system, you can pretty much guarantee
that it has passed Microsoft's hardware compliance tests, including the test
of its ACPI implementation. However, these tests come up short in that they
@ -183,7 +261,8 @@ Microsoft's implementation of ACPI. When that same machine is used with
Linux, some classes of errors that did not manifest themselves under Windows
may become apparent. To protect against this problem, the Linux ACPI driver
maintains a "bad BIOS" blacklist of known BIOS's that are known to not be ACPI
compliant, and as a result will refuse to enable ACPI if your system is listed.</para>
compliant, and as a result will refuse to enable ACPI if your system is
listed.</para>
<para>Many manufacturers are now validating that their systems run on Linux.
However, they use major Linux distributions with the default kernel. This
@ -193,9 +272,19 @@ kernel. This presents a slight dilemma in that Linux distributions want to
ship kernels that run on as many systems as possible, but there have been some
positive moves in this area lately.</para>
<para>To conserve energy while remaining quickly available, ACPI-compatible PCs may enter system sleep states. The ACPI specification defines five of these states, known as S-states. Unlike processor sleep states, no work is done by the system under S-states. Each state introduces greater power savings but requires commensurately more time to awaken and begin performing work. These are patterned on system states from the APM standard, a predecessor of ACPI.</para>
<para>To conserve energy while remaining quickly available, ACPI-compatible
PCs may enter system sleep states. The ACPI specification defines five of
these states, known as S-states. Unlike processor sleep states, no work is
done by the system under S-states. Each state introduces greater power savings
but requires commensurately more time to awaken and begin performing work.
These are patterned on system states from the APM standard, a predecessor of
ACPI.</para>
<para>Full details on ACPI sleep states are available at <ulink url="http://acpi.sourceforge.net/documentation/sleep.html">http://acpi.sourceforge.net/documentation/sleep.html</ulink>. Processor states are described at <ulink url="http://acpi.sourceforge.net/documentation/processor.html">http://acpi.sourceforge.net/documentation/processor.html</ulink>.</para>
<para>Full details on ACPI sleep states are available at
<ulink url="http://acpi.sourceforge.net/documentation/sleep.html">http://acpi.sourceforge.net/documentation/sleep.html</ulink>.
Processor states are described at
<ulink url="http://acpi.sourceforge.net/documentation/processor.html">http://acpi.sourceforge.net/documentation/processor.html</ulink>.
</para>
<para>For more specific background information on ACPI itself, you can visit
the ACPI website at
@ -205,56 +294,156 @@ the ACPI website at
<sect2 id="whichone">
<title>APM vs. ACPI: Which one?</title>
<para>There are currently two competing standards for providing power management: APM and ACPI. Both cannot be used at the same time, so which one is best for your situation? If you have a relatively recent (>2.4.20) kernel and are not intimidated by kernel builds and patching source code, you'll find many benefits with the flexibility of ACPI. If you just want to enable generic power management, or are using an older machine, choose APM. Neither method spins down idle hard drives; use hdparm for that instead. Either way, your system's BIOS must correctly support the power management scheme you'd like to use as well; if your system does not fully support either standard, some of the power management options might crash your system and/or cause data loss. You have been warned!</para>
<para>There are currently two competing standards for providing power
management: APM and ACPI. Both cannot be used at the same time, so which one
is best for your situation? If you have a relatively recent (>2.4.20) kernel
and are not intimidated by kernel builds and patching source code, you'll find
many benefits with the flexibility of ACPI. If you just want to enable
generic power management, or are using an older machine, choose APM. Neither
method spins down idle hard drives; use hdparm for that instead. Either way,
your system's BIOS must correctly support the power management scheme you'd
like to use as well; if your system does not fully support either standard,
some of the power management options might crash your system and/or cause data
loss. You have been warned!</para>
<para>Even if you don't enable power management on your x86-laptop, Linux will always issue the HLT instruction to your
<para>Even if you don't enable power management on your x86-laptop, Linux will
always issue the HLT instruction to your
processor whenever nothing needs to be done
<footnote><para>source/arch/i386/kernel/process.c</para></footnote>.
Many Microsoft Windows CPU cooling program use this technique. This results in lowering the power consumption of your CPU. Note that the system doesn't power down when it receives the HLT instruction; it just stops executing instructions until there is an interrupt.</para>
<para>Some system manufacturers may have omitted the pre-ACPI tables used for
SMP configuration. In this case, ACPI is required
<footnote><para>Andrew Grover</para></footnote>.
If a system supports
HyperThreading, it must use ACPI tables to discover all the virtual processors
present. IA64 machines require ACPI, and NUMA servers are starting to require
it for proper initialization as well.</para>
Many Microsoft Windows CPU cooling program use this technique. This results
in lowering the power consumption of your CPU. Note that the system doesn't
power down when it receives the HLT instruction; it just stops executing
instructions until there is an interrupt.</para>
<para>There is generally no advantage to
enabling either type of power management on servers or workstations that do not fall into
enabling either type of power management on servers or workstations that do
not fall into
these categories.</para>
</sect2>
<sect2 id="hyperthread">
<title>SMP, Hyper-Threading, IA64 &amp; NUMA</title>
<para>Some SMP system manufacturers may have omitted the pre-ACPI tables used
for SMP configurations. In this case, ACPI is required.</para>
<para>If you have a newer system that supports
<ulink url="http://www.intel.com/technology/hyperthread/">Hyper-Threading</ulink>,
you will need to enable ACPI (and, of course, SMP). Without it, your Linux system
may be unable to discover and initialize all of the virtual processors.</para>
<para>IA64 machines require ACPI as well. Additionally, NUMA servers are
starting to require it for proper initialization.</para>
</sect2>
</sect1>
<sect1 id="displaytypes">
<title>DPMS</title>
<para><command>DPMS</command> (Display Power Management Signaling) is a standard to
reduce power consumption in monitors. Typically, both the monitor and the video card
must support the DPMS standard in order to receive any benefit from it. DPMS specifies
four modes of operation (in order of increasing power savings): "Normal", "Standby",
"Suspend" and "Off". Two signal lines, "Horizontal Sync" and "Vertical Sync" provide
a method for signaling these four different states to a DPMS monitor.</para>
<sect1 id="powersav">
<title>Power Management Techniques</title>
<para>The basic goal of any power management technique is to reduce an entity's consumption. In the case of laptop power management, our focus is on decreasing CPU and hard drive usage. To make things a bit simpler, this is broken down into <emphasis>obvious, semi-obvious,</emphasis> and <emphasis>non-obvious</emphasis> techniques. Granted, your mileage may vary.</para>
<para>A good technical resource on DPMS is available at
<ulink url="http://webpages.charter.net/dperr/dpms.htm">http://webpages.charter.net/dperr/dpms.htm</ulink>.
</para>
<sect2 id="normal">
<title>Normal</title>
<para><command>Normal</command> means just that -- the monitor is fully powered and on.
LCD laptop panels and LCD flat screens use considerably less power than traditional CRT
monitors.</para>
</sect2>
<sect2 id="standby">
<title>Standby</title>
<para><command>Standby</command> is used to describe a very minor power
savings level. This setting usually involves
blanking the screen by turning off the electron (RGB) gun. However, the
power supply is left on and the tube filaments energized.
When you need to use the monitor again, the monitor will come back on very
quickly.
This option requires DPMS monitor and video card support along with enabling
DPMS in XFree86.
Standby is sometimes referred to as <emphasis>hsync suspend mode</emphasis>
since the horizontal sync signal
is turned off to signal this power management state to a DPMS monitor.</para>
</sect2>
<sect2 id="suspend">
<title>Suspend to Disk</title>
<title>Suspend</title>
<para><command>Suspend</command> is used to describe a very strong low power
state. This setting usually involves the same
power conservation as <command>Standby</command> however in addition the power
supply to the monitor is turned off.
This option requires DPMS monitor and video card support along with enabling
DPMS in XFree86.
Suspend is sometimes referred to as <emphasis>vsync suspend mode</emphasis>
since the vertical sync signal
is turned off to signal this power management state to a DPMS monitor.</para>
</sect2>
<para>Suspend to Disk (S2D) is still an elusive task under Linux. The main project at the moment is swsusp, available at <ulink url="http://sourceforge.net/projects/swsusp">http://sourceforge.net/projects/swsusp</ulink>. It's still in beta and requires manual patching of the kernel source.</para>
<sect2 id="off">
<title>Off</title>
<para><command>Off</command> usually means just that -- the computer monitor
is turned off. Usually, a small
auxiliary circuit stays on to monitor the signals from the computer to turn
the monitor back on when data needs to be displayed to the screen.
Obviously, this keeps power consumption to a bare minimum (if not zero).
While the power saving is substantial, to reactivate the monitor may take
several seconds.
This option requires DPMS monitor and video card support along with enabling
DPMS in XFree86.
Both the horizontal and vertical sync signals are turned off to signal this
power management state to a DPMS monitor.</para>
</sect2>
</sect1>
<sect1 id="methods">
<title>Power Management Methods</title>
<para>The basic goal of any power management technique is to reduce an
entity's consumption. In the case of laptop power management, our focus is on
decreasing CPU and hard drive usage. To make things a bit simpler, this is
broken down into <emphasis>obvious, semi-obvious,</emphasis> and
<emphasis>non-obvious</emphasis> techniques. Granted, your mileage may
vary.</para>
<sect2 id="swsusp">
<title>swsusp(8)</title>
<para>Suspend to Disk (S2D) is still an elusive task under Linux. The main
project at the moment is swsusp, available at
<ulink url="http://sourceforge.net/projects/swsusp">http://sourceforge.net/projects/swsusp</ulink>.
It's still fairly new and requires a bit of configuration to enable it.</para>
</sect2>
<sect2 id="hdparm">
<title>hdparm Tuning</title>
<para><command>hdparm</command> is a Linux shell utility that can be used to spin down and improve the performance
of various ATA/IDE drives. If it's not included with your system, you can fetch the source from
<title>hdparm(8)</title>
<para><command>hdparm</command> is a Linux shell utility that can be used to
spin down and improve the performance
of various ATA/IDE drives. If it's not included with your system, you can
fetch the source from
<ulink url="http://freshmeat.net/redir/hdparm/4062/url_homepage/hardware">http://freshmeat.net/redir/hdparm/4062/url_homepage/hardware</ulink>.
For example, the following provides 32-bit IO support with sync (-c3), DMA support (-d1), Advanced Power Management (-B128), write-caching
(-W1), disk spin down after five minutes (-S60). gains me tremendous performance with added power savings. Note that your mileage may vary, and you'll want to adjust this for your specific system to prevent data loss (especially the -B and -m flags!).</para>
For example, the following provides 32-bit IO support with sync (-c3), DMA
support (-d1), Advanced Power Management (-B128), write-caching
(-W1), disk spin down after five minutes (-S60). gains me tremendous
performance with added power savings. Note that your mileage may vary, and
you'll want to adjust this for your specific system to prevent data loss
(especially the -B and -m flags!).</para>
<para>In the following example, we run some read/write benchmarks of our hard drive before and after using <command>hdparm</command>.
Note that while our cache reads remain about the same, our actual physical reads from the drive increase tremendously!
If you like living on the edge, you can play with the -m, -c, -B, and -u switches with caution (see the man page).</para>
<para>In the following example, we run some read/write benchmarks of our hard
drive before and after using <command>hdparm</command>.
Note that while our cache reads remain about the same, our actual physical
reads from the drive increase tremendously!
If you like living on the edge, you can play with the -m, -c, -B, and -u
switches with caution (see the man page).</para>
<screen>
bash# hdparm -tT /dev/hda
@ -269,30 +458,39 @@ Timing buffered disk reads: 72 MB in 3.05 seconds = 23.58 MB/sec
</sect2>
<sect2 id="syslog">
<title>syslog Tuning</title>
<para>Examine your <command>/etc/syslog.conf</command> file for unnecessary logging activity
<sect2 id="sysklogd">
<title>sysklogd(8)</title>
<para>Examine your <command>/etc/syslog.conf</command> file for unnecessary
logging activity
and to optimize its performance.
If you don't want to log any system activity, consider disabling syslogd and klogd entirely or,
If you don't want to log any system activity, consider disabling syslogd and
klogd entirely or,
at the very least, minimize the amount of logging your system performs.
You can also prefix each entry with the minus sign (-) to omit syncing the file after each log entry
You can also prefix each entry with the minus sign (-) to omit syncing the
file after each log entry
<footnote><para>syslogd.c</para></footnote>.
For example, this will log anything with a priority of <emphasis>info</emphasis> or higher, but lower than
<emphasis>warning</emphasis>, to <command>/var/adm/messages</command> or <command>/var/adm/mail</command>
without needing to sync to disk after each write. Since we want to keep all messages with a priority of
<emphasis>warning</emphasis>, this will be logged to a different file without disabling
For example, this will log anything with a priority of
<emphasis>info</emphasis> or higher, but lower than
<emphasis>warning</emphasis>, to <command>/var/log/messages</command> or
<command>/var/log/mail</command>
without needing to sync to disk after each write. Since we want to keep all
messages with a priority of
<emphasis>warning</emphasis>, this will be logged to a different file without
disabling
disk syncing (to prevent data loss in the event of a system crash).</para>
<screen>
*.warning /var/adm/syslog
*.warning /var/log/syslog
*.info;*.!warning;mail.none -/var/log/messages
mail.info;mail.!warning -/var/log/mail
</screen>
<para>Another item to be aware of is the <command>-- MARK --</command> messages that <command>syslogd(8)</command> writes.
This will affect your hard drive inactivity settings. You can simply disable this by running <command>syslogd(8)</command> with:</para>
<para>Another item to be aware of is the <command>-- MARK --</command>
messages that <command>syslogd(8)</command> writes.
This will affect your hard drive inactivity settings. You can simply disable
this by running <command>syslogd(8)</command> with:</para>
<para>
<screen>
@ -309,29 +507,25 @@ fi
</sect2>
<sect2 id="xf86">
<title>XF86Config Tuning</title>
<para>There are essentially two different types of screen blanking that can be performed under X-Windows: BlankTime and DPMS.
The first is simply a fake "blanking" effect that doesn't actually save any power. The others are specific only to
DPMS-compliant monitors, and must be specifically enabled to take effect. They are located in your <command>XF86Config</command>
<title>XFree86</title>
<para>There are essentially two different types of screen blanking that can be
performed under XFree86: BlankTime and DPMS.
The first is simply a fake "blanking" effect that doesn't actually save any
power. The others are specific only to
DPMS-compliant monitors, and must be specifically enabled to take effect.
They are located in your <command>XF86Config</command>
file, which normally resides in <command>/etc/X11/XF86Config</command>.</para>
<para>DPMS (Display Power Management Signaling) is a standard to reduce power consumption in monitors
<footnote><para>http://www.vesa.org/vbe3.pdf</para></footnote>.
Typically, both the monitor and the video card must support the DPMS standard in order to receive any
benefit from it. DPMS specifies four modes of operation (in order of increasing power savings):
"Normal", "Standby", "Suspend" and "Off". Two signal lines, "Horizontal Sync" and
"Vertical Sync" provide a method for signaling these four different states to a DPMS monitor.</para>
<para>If you have a DPMS-compliant monitor, you might want to try enabling support for it under the
<emphasis>Monitor</emphasis> section of your <command>XF86Config</command> file:
<para>If you have a DPMS-compliant monitor, you might want to try enabling
support for it under the
<emphasis>Monitor</emphasis> section of your <command>XF86Config</command>
file:
</para>
<para>
<screen>
Section "Monitor"
[... other values here ...]
Option "DPMS"
EndSection
</screen>
@ -343,118 +537,146 @@ following items in the <emphasis>ServerLayout</emphasis> section.</para>
<para>
<screen>
Section "ServerLayout"
Option "BlankTime" "10" # Blank the screen in 10 minutes (Fake)
Option "StandbyTime" "20" # Turn off screen in 20 minutes (DPMS)
Option "SuspendTime" "30" # Full hibernation in 30 minutes (DPMS)
Option "OffTime" "40" # Turn off DPMS monitor (DPMS)
Option "BlankTime" "10" # Blank the screen in 10 minutes
Option "StandbyTime" "20" # Turn off screen in 20 minutes
Option "SuspendTime" "30" # Full hibernation in 30 minutes
Option "OffTime" "40" # Turn off DPMS monitor
EndSection
</screen>
</para>
<para><command>BlankTime</command>
is not actually a power saving level at all. The screen is sent
a "fake" blanking effect and defaults to activate after 10 minutes. Alternately, it can indicate the number of
minutes until the screensaver should activate. It has nothing to do with DPMS.</para>
<para>It's worth noting that <command>BlankTime</command> is not actually a
power saving level at all. The screen is sent
a "fake" blanking effect and defaults to activate after 10 minutes.
Alternately, it can indicate the number of
minutes until the screensaver should activate. It has nothing to do with
DPMS.</para>
<para><command>StandbyTime</command>
is a very minor power saving level. This setting usually involves
blanking the screen by turning off the electron (RGB) gun. However, the
power supply is left on and the tube filaments energized.
When you need to use the monitor again, the monitor will come back on very quickly.
This option requires DPMS monitor/video-card support and defaults to 20 minutes under X-Windows.
Also known as <emphasis>hsync suspend mode</emphasis>, since the horizontal sync signal
is turned off to signal this power management state to a DPMS monitor.</para>
<para><command>SuspendTime</command>
is a very strong low power alternative. This setting usually involves the same
power conservation as <command>StandbyTime</command>, however in addition the power supply is turned off.
This option requires DPMS monitor/video-card support and defaults
to 30 minutes under X-Windows. Also known as <emphasis>vsync suspend mode</emphasis>, since the vertical sync signal
is turned off to signal this power management state to a DPMS monitor.</para>
<para><command>OffTime</command>
usually means just that. The computer monitor is turned off. A small
auxiliary circuit stays on to monitor the signals from the computer to turn
the monitor back on when data needs to be displayed to the screen.
Obviously, this keeps power consumption to a bare minimum (zero).
While the power saving is substantial, to reactivate the monitor may take up to 8-10 seconds.
This option requires DPMS monitor/video-card support and defaults to 40 minutes under
X-Windows. Both the horizontal and vertical sync signals are turned off to signal this power
management state to a DPMS monitor.</para>
<para>After activating your changes and restarting X-Windows, you might want to examine your
<para>After activating your changes and restarting X-Windows, you might want
to examine your
logfile to see if your video card has any problems with your changes:</para>
<para>
<screen>
$ egrep "^\(WW|EE\)" /var/log/XFree86.0.log
bash$ egrep "^\(WW|EE\)" /var/log/XFree86.0.log
</screen>
</para>
<para>There may be additional options that you can enable for your specific video card/chip driver; see the
<ulink url="http://www.xfree86.org/support.html">XFree86 Documentation</ulink> website for specifics.</para>
<para>There may be additional options that you can enable for your specific
video card/chip driver; see the
<ulink url="http://www.xfree86.org/support.html">XFree86 Documentation</ulink>
website for specifics.</para>
<para>Of course, all of this can also be activated "on-the-fly" by using <command>xset(1)</command>.
If you don't have access to your system's <command>XF86Config</command> file, a good place to put these commands would be in
your <command>~/.Xsession</command> or <command>~/.xinitrc</command> file.</para>
<para>Of course, all of this can also be activated "on-the-fly" by using
<command>xset(1)</command>.
If you don't have access to your system's <command>XF86Config</command> file,
a good place to put these commands would be in
your <command>~/.Xsession</command> or <command>~/.xinitrc</command>
file.</para>
<para>
<screen>
$ xset -dpms # Disable DPMS
$ xset +dpms # Enable DPMS
$ xset s off # Disable screen blanking
$ xset s 150 # Blank the screen after 150 seconds
$ xset dpms 300 600 900 # Set standby, suspend, & off times (in seconds)
$ xset dpms force standby # Immediately go into standby mode
$ xset dpms force suspend # Immediately go into suspend mode
$ xset dpms force off # Immediately turn off the monitor
$ xset -q # Query current settings
bash$ xset -dpms # Disable DPMS
bash$ xset +dpms # Enable DPMS
bash$ xset s off # Disable screen blanking
bash$ xset s 150 # Blank the screen after 150 seconds
bash$ xset dpms 300 600 900 # Set standby, suspend, & off times (in seconds)
bash$ xset dpms force standby # Immediately go into standby mode
bash$ xset dpms force suspend # Immediately go into suspend mode
bash$ xset dpms force off # Immediately turn off the monitor
bash$ xset -q # Query current settings
</screen>
</para>
<para>If instead you're using the Linux console (not X-Windows), you'll want to use <command>setterm(1)</command>:</para>
<para>If instead you're using the Linux console (not X-Windows), you'll want
to use <command>setterm(1)</command>:</para>
<para>
<screen>
$ setterm -blank 10 # Blank the screen in 10 minutes
$ setterm -powersave on # Put the monitor into VESA power saving mode
$ setterm -powerdown 20 # Set the VESA powerdown to 20 minutes
bash$ setterm -blank 10 # Blank the screen in 10 minutes
bash$ setterm -powersave on # Put the monitor into VESA power saving mode
bash$ setterm -powerdown 20 # Set the VESA powerdown to 20 minutes
</screen>
</para>
</sect2>
<sect2 id="kde">
<title>KDE 3.1</title>
<sect3 id="kdedisplay">
<title>Display Power Control</title>
<para>Assuming you've configured XFree86 to support DPMS, simply run
<command>kcontrol</command> and choose <command>Power
Control</command>/<command>Display Power Control</command>. From here, you
can configure Standby, Suspend, and Power off settings for your monitor.</para>
</sect3>
<sect3 id="kdebattery">
<title>Laptop Battery</title>
<para>Assuming you've configured your kernel to support either APM or ACPI,
simply run <command>kcontrol</command> and choose <command>Power
Control</command>/<command>Laptop Battery</command>. From here, you can
configure the various settings for your system based on the level of battery
power remaining.</para>
<para>It's worth noting that some people running ACPI tend to see the
following message:</para>
<screen>
Your computer seems to have a partial ACPI installation. ACPI was probably
enabled, but some of the sub-options were not - you need to enable at least
'AC Adaptor' and 'Control Method Battery' and then rebuild your kernel.
</screen>
<para>If you see this, either ACPI is not installed or, more likely, KDE does
not recognize your particular Linux ACPI Subsystem. If patching the kernel
with any ACPI updates does not resolve this, you must either not use this KDE
function or, alternately, revert back to using APM.
</para>
</sect3>
</sect2>
<sect2 id="energystar">
<title>Energy Star</title>
<para><ulink url="http://www.energystar.gov">Energy Star</ulink> is a United States government-backed program
<para><ulink url="http://www.energystar.gov">Energy Star</ulink> is a United
States government-backed program
to promote energy efficiency standards. Of interest:</para>
<itemizedlist>
<listitem><para>An ENERGY STAR qualified computer, in sleep mode,
uses 70% less electricity than computers without power management features.</para></listitem>
uses 70% less electricity than computers without power
management features.</para></listitem>
<listitem><para>An ENERGY STAR qualified monitor, in sleep mode,
uses 90% less electricity than monitors without power management features.</para></listitem>
uses 90% less electricity than monitors without power
management features.</para></listitem>
</itemizedlist>
<para>Typically, Energy Star savings is accomplished by other power management settings and is not, in and of itself,
<para>Typically, Energy Star savings is accomplished by other power management
settings and is not, in and of itself,
a power management technique.</para>
</sect2>
<sect2 id="swap">
<title>Swapfile Tuning</title>
<para>Consider disabling your swap file in <command>/etc/fstab</command> to reduce hard drive access.
<title>Swap File</title>
<para>Consider disabling your swap file in <command>/etc/fstab</command> to
reduce hard drive access.
If you've got lots of memory, this is definitely the way to go.
One way to tell if you need your swap file is to enable it, use your system for a period of time,
One way to tell if you need your swap file is to enable it, use your system
for a period of time,
and examine <command>/proc/meminfo</command> and <command>/proc/swaps</command>
to determine how much free memory you've got on average, and whether or not your swap file is even being utilized.</para>
to determine how much free memory you've got on average, and whether or not
your swap file is even being utilized.</para>
<para>For example, today I've compiled several intensive programs and have been running my laptop for about eight hours straight.
<para>For example, today I've compiled several intensive programs and have
been running my laptop for about eight hours straight.
A simple examination of my system reveals:</para>
<screen>
bash$ cat /proc/swaps
Filename Type Size Used Priority
Filename Type Size Used
Priority
/dev/hda3 partition 136544 0 -1
bash$ cat /proc/meminfo
@ -485,18 +707,25 @@ HugePages_Free: 0
Hugepagesize: 4096 kB
</screen>
<para>Given this, I'd opt to disable my swapfile if this is any indicator of my future usage.</para>
<para>Given this, I'd opt to disable my swapfile if this is any indicator of
my future usage.</para>
</sect2>
<sect2 id="tmpfs">
<title>/tmp Tuning</title>
<para>Compile your kernel with tmpfs (temporary file system) enabled and mount your /tmp directory using it.
The useful bit here is that nothing will be written to your hard drive on this mount point as it will act like
a RAM disk (however nothing will be saved either). The advantage of tmpfs over the more traditional ramfs is
that it lives in the kernel internal cache and grows and shrinks to accommodate the files placed there.
See your kernel's Documentation/filesystems/tmpfs.txt for full information. If you don't specify a maximum
<title>tmpfs</title>
<para>Compile your kernel with tmpfs (temporary file system) enabled and mount
your /tmp directory using it.
The useful bit here is that nothing will be written to your hard drive on this
mount point as it will act like
a RAM disk (however nothing will be saved either). The advantage of tmpfs
over the more traditional ramfs is
that it lives in the kernel internal cache and grows and shrinks to
accommodate the files placed there.
See your kernel's Documentation/filesystems/tmpfs.txt for full information.
If you don't specify a maximum
size, it will default to a ceiling limit of half your available memory.
An example /etc/fstab with 100MB temporary ram file mounted on /tmp would look like:
An example /etc/fstab with 100MB temporary ram file mounted on /tmp would look
like:
<screen>
tmpfs /tmp tmpfs size=100m,mode=1777 0 0
@ -510,26 +739,31 @@ An example /etc/fstab with 100MB temporary ram file mounted on /tmp would look l
<para>
Modifying /proc/sys/vm/bdflush allows a user to specify under what
circumstances dirty buffers are flushed to disk, how many such
buffers exist, etc. Details are in linux_src_tree/Documentation/sysctl/vm.txt (thanks to Marc Liberatore for pointing this out).</para>
buffers exist, etc. Details are in linux_src_tree/Documentation/sysctl/vm.txt
(thanks to Marc Liberatore for pointing this out).</para>
<para>Boot your system and list the currently loaded modules with lsmod.
Anything listed here most likely needs to be loaded on a regular basis;
compiling these in as part of your kernel rather than as loadable modules may
help to decrease the amount of time they must be loaded from disk, and to a
very minor degree, decrease the amount of disk access required to start your system.</para>
very minor degree, decrease the amount of disk access required to start your
system.</para>
<para>Examine your crontab settings to see if anything is being run on a
regular basis. Comment out any unnecessary items. Don't forget to examine
every user's crontab, including the user 'nobody'. If you don't need to schedule
every user's crontab, including the user 'nobody'. If you don't need to
schedule
any background activity, consider disabling crond alltogether. The same
advice goes for atd.</para>
<para>If you run httpd to test and/or develop web pages, try altering the
values of MinSpareServers and StartServers to 1. Don't define any
CustomLogging or at least increase the value of LogLevel to warn. If you're
really sure of yourself, you can change the ErrorLog directive to point to /dev/null.</para>
really sure of yourself, you can change the ErrorLog directive to point to
/dev/null.</para>
<para>Consider creating a power-saving script that will immediately take your laptop
<para>Consider creating a power-saving script that will immediately take your
laptop
into low-power mode:</para>
<para>
@ -545,17 +779,29 @@ fi
</screen>
</para>
<para>Additionally, it's worth considering anything in the following areas:</para>
<para>Additionally, it's worth considering anything in the following
areas:</para>
<para><itemizedlist>
<listitem><para>Adjust your system's BIOS settings to decrease or turn off your display's backlight.</para></listitem>
<listitem><para>Adjust your system's BIOS settings to reduce the CPU clock speed while on battery.</para></listitem>
<listitem><para>Avoid using PCMCIA devices while on battery. Better yet, eject your PCMCIA cards when not in use.</para></listitem>
<listitem><para>Avoid using external devices with your computer while on battery.
This includes printers, external monitors, zip drives, and portable cameras.</para></listitem>
<listitem><para>Avoid using built-in devices while on battery. This includes cdroms and floppy drives.</para></listitem>
<listitem><para>Use simple software. A full blown multimedia application will create a lot more system load and disk activity than a small simple word processor</para></listitem>
<listitem><para>Use a simple window manager. While Gnome and KDE are nice, the extra time it takes to load and run is not worth it while on
battery power. One nifty idea is to use a different <command>xinitrc</command> script to launch a different, more simple window manager based on
<listitem><para>Adjust your system's BIOS settings to decrease or turn off
your display's backlight.</para></listitem>
<listitem><para>Adjust your system's BIOS settings to reduce the CPU clock
speed while on battery.</para></listitem>
<listitem><para>Avoid using PCMCIA devices while on battery. Better yet,
eject your PCMCIA cards when not in use.</para></listitem>
<listitem><para>Avoid using external devices with your computer while on
battery.
This includes printers, external monitors, zip drives, and portable
cameras.</para></listitem>
<listitem><para>Avoid using built-in devices while on battery. This includes
cdroms and floppy drives.</para></listitem>
<listitem><para>Use simple software. A full blown multimedia application will
create a lot more system load and disk activity than a small simple word
processor</para></listitem>
<listitem><para>Use a simple window manager. While Gnome and KDE are nice, the
extra time it takes to load and run is not worth it while on
battery power. One nifty idea is to use a different
<command>xinitrc</command> script to launch a different, more simple window
manager based on
whether or not your system is on battery power.</para></listitem>
</itemizedlist></para>
</sect2>
@ -564,17 +810,22 @@ whether or not your system is on battery power.</para></listitem>
<sect2 id="myth">
<title>Power Saving Myths</title>
<para>It used to be beneficial to recompile the Linux PCMCIA drivers to allow the slots to have APM power support. However, most of the functionality of these drivers are now built into the kernel itself.
<para>It used to be beneficial to recompile the Linux PCMCIA drivers to allow
the slots to have APM power support. However, most of the functionality of
these drivers are now built into the kernel itself.
If you're interested in specifics, the PCMCIA project page is available at
<ulink url="http://sourceforge.net/projects/pcmcia-cs/">http://sourceforge.net/projects/pcmcia-cs/</ulink>.
</para>
<para>Some people believe that APM offers better power savings over ACPI, and vice-versa. While their power management
techniques differ, in actual battery-usage tests, both reportedly perform about the same.</para>
<para>Some people believe that APM offers better power savings over ACPI, and
vice-versa. While their power management
techniques differ, in actual battery-usage tests, both reportedly perform
about the same.</para>
<para>Contrary to popular belief, Lithium Ion (see below) batteries
<emphasis>do</emphasis> suffer from a memory effect.
Luckily, the effect is not large over the lifespan of a typical battery (3-4 years). Anyone who tells you different
Luckily, the effect is not large over the lifespan of a typical battery (3-4
years). Anyone who tells you different
is selling something.</para>
</sect2>
@ -600,7 +851,8 @@ weeks. As this battery contains cadmium, a toxic material, it should always
be recycled or disposed of properly.</para>
<para>NiCad batteries, and to a some degree NiMH batteries, suffer from what's
called the <emphasis>memory effect</emphasis>. Memory Effect means that if a battery is
called the <emphasis>memory effect</emphasis>. Memory Effect means that if a
battery is
repeatedly only partially discharged before recharging, the battery will
forget that it can further discharge. The best way to prevent this situation
is to fully charge and discharge your battery on a regular basis.</para>
@ -624,7 +876,7 @@ bulk or weight.</para>
<title>Lithium Ion (Li-ion)</title>
<para> Lithium Ion (Li-ion) are the new standard for portable power. Li-ion
batteries produce the same energy as NiMH but weighs approximately 20%-35%
less. They do not suffer from the memory effect unlike their NiMH and Ni-Cd
less. They do not suffer significantly from the memory effect unlike their NiMH and Ni-Cd
counterparts. Their substances are non-hazardous to the 0. Because
lithium ignites very easily, they require special handling. Unfortunately,
few consumer recycling programs have been established for Li-ion batteries at
@ -659,13 +911,15 @@ against voltage peaks from your ac outlet.</para>
<para>As the manufacturers change the shapes of their batteries every few
months, you might have problems to find a new battery for your laptop in a few
years from now. This is somewhat of a concern only if you anticipate using the
same laptop several years from now. If in doubt, buy a spare battery now - before it's out of stock.</para>
same laptop several years from now. If in doubt, buy a spare battery now -
before it's out of stock.</para>
<para>New batteries come in a discharged condition and must be fully charged
before use. It is recommended that you fully charge and discharge the new
battery two to four times to allow it to reach its maximum rated capacity. It
is generally recommend that you perform an overnight charge (approximately
twelve hours) for this. Note: It is normal for a battery to become warm to the touch during charging and
twelve hours) for this. Note: It is normal for a battery to become warm to the
touch during charging and
discharging. When charging the battery for the first time, the device may
indicate that charging is complete after just 10 or 15 minutes. This is a
normal with rechargeable batteries. New batteries are hard for the device to
@ -673,7 +927,8 @@ charge; they have never been fully charged and are not broken in. Sometimes the
device's charger will stop charging a new battery before it is fully charged.
If this happens, remove the battery from the device and then reinsert it. The
charge cycle should begin again. This may happen several times during the
first battery charge. Don't worry; it's perfectly normal. Keep the battery healthy by fully
first battery charge. Don't worry; it's perfectly normal. Keep the battery
healthy by fully
charging and then fully discharging it at least once every two to three weeks.
Exceptions to the rule are Li-Ion batteries which do not suffer from the
memory effect.</para>
@ -685,7 +940,8 @@ High humidity and temperatures can cause the battery to deteriorate, so these
should be avoided during storage.</para>
<para>Do not remove and carry a battery pack in your pocket, purse, or other
container where metal objects (such as car keys or paper clips) could short-circuit the
container where metal objects (such as car keys or paper clips) could
short-circuit the
battery terminals. The resulting excessive current flow can cause extremely
high temperatures and may result in damage to the battery pack or cause fire
or burns.</para>
@ -695,17 +951,17 @@ or burns.</para>
<sect1 id="intro">
<title>Appendix</title>
<para>This document was lovingly handcrafted on a Dell Latitude C400 laptop running Slackware Linux 9.0,
in case anyone asks.</para>
<para>This document was lovingly handcrafted on a Dell Latitude C400 laptop
running Slackware Linux 9.0, in case anyone asks.</para>
<para>This document would not have been possible without the excellent material initially developed by Hanno Muller <email>kontakt@hanno.de</email>.</para>
<para>This document would not have been possible without the excellent
material initially developed by Hanno Muller
<email>kontakt@hanno.de</email>.</para>
<para>This material may be distributed only subject to the terms and conditions set forth in the
Open Publication License, v1.0 (available at http://www.opencontent.org/openpub/).</para>
<para>Copyright (c) 2003 David Lechnyr. Redistribution and use, with or without modification, are permitted provided that the copyright notice, this list of conditions and the following disclaimer be included.</para>
<para>THIS DOCUMENTATION IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.</para>
<para>This document is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.</para>
</sect1>