162306a36Sopenharmony_ci.. SPDX-License-Identifier: GPL-2.0
262306a36Sopenharmony_ci.. include:: <isonum.txt>
362306a36Sopenharmony_ci
462306a36Sopenharmony_ci===========================
562306a36Sopenharmony_ciPower Management Strategies
662306a36Sopenharmony_ci===========================
762306a36Sopenharmony_ci
862306a36Sopenharmony_ci:Copyright: |copy| 2017 Intel Corporation
962306a36Sopenharmony_ci
1062306a36Sopenharmony_ci:Author: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
1162306a36Sopenharmony_ci
1262306a36Sopenharmony_ci
1362306a36Sopenharmony_ciThe Linux kernel supports two major high-level power management strategies.
1462306a36Sopenharmony_ci
1562306a36Sopenharmony_ciOne of them is based on using global low-power states of the whole system in
1662306a36Sopenharmony_ciwhich user space code cannot be executed and the overall system activity is
1762306a36Sopenharmony_cisignificantly reduced, referred to as :doc:`sleep states <sleep-states>`.  The
1862306a36Sopenharmony_cikernel puts the system into one of these states when requested by user space
1962306a36Sopenharmony_ciand the system stays in it until a special signal is received from one of
2062306a36Sopenharmony_cidesignated devices, triggering a transition to the ``working state`` in which
2162306a36Sopenharmony_ciuser space code can run.  Because sleep states are global and the whole system
2262306a36Sopenharmony_ciis affected by the state changes, this strategy is referred to as the
2362306a36Sopenharmony_ci:doc:`system-wide power management <system-wide>`.
2462306a36Sopenharmony_ci
2562306a36Sopenharmony_ciThe other strategy, referred to as the :doc:`working-state power management
2662306a36Sopenharmony_ci<working-state>`, is based on adjusting the power states of individual hardware
2762306a36Sopenharmony_cicomponents of the system, as needed, in the working state.  In consequence, if
2862306a36Sopenharmony_cithis strategy is in use, the working state of the system usually does not
2962306a36Sopenharmony_cicorrespond to any particular physical configuration of it, but can be treated as
3062306a36Sopenharmony_cia metastate covering a range of different power states of the system in which
3162306a36Sopenharmony_cithe individual components of it can be either ``active`` (in use) or
3262306a36Sopenharmony_ci``inactive`` (idle).  If they are active, they have to be in power states
3362306a36Sopenharmony_ciallowing them to process data and to be accessed by software.  In turn, if they
3462306a36Sopenharmony_ciare inactive, ideally, they should be in low-power states in which they may not
3562306a36Sopenharmony_cibe accessible.
3662306a36Sopenharmony_ci
3762306a36Sopenharmony_ciIf all of the system components are active, the system as a whole is regarded as
3862306a36Sopenharmony_ci"runtime active" and that situation typically corresponds to the maximum power
3962306a36Sopenharmony_cidraw (or maximum energy usage) of it.  If all of them are inactive, the system
4062306a36Sopenharmony_cias a whole is regarded as "runtime idle" which may be very close to a sleep
4162306a36Sopenharmony_cistate from the physical system configuration and power draw perspective, but
4262306a36Sopenharmony_cithen it takes much less time and effort to start executing user space code than
4362306a36Sopenharmony_cifor the same system in a sleep state.  However, transitions from sleep states
4462306a36Sopenharmony_ciback to the working state can only be started by a limited set of devices, so
4562306a36Sopenharmony_citypically the system can spend much more time in a sleep state than it can be
4662306a36Sopenharmony_ciruntime idle in one go.  For this reason, systems usually use less energy in
4762306a36Sopenharmony_cisleep states than when they are runtime idle most of the time.
4862306a36Sopenharmony_ci
4962306a36Sopenharmony_ciMoreover, the two power management strategies address different usage scenarios.
5062306a36Sopenharmony_ciNamely, if the user indicates that the system will not be in use going forward,
5162306a36Sopenharmony_cifor example by closing its lid (if the system is a laptop), it probably should
5262306a36Sopenharmony_cigo into a sleep state at that point.  On the other hand, if the user simply goes
5362306a36Sopenharmony_ciaway from the laptop keyboard, it probably should stay in the working state and
5462306a36Sopenharmony_ciuse the working-state power management in case it becomes idle, because the user
5562306a36Sopenharmony_cimay come back to it at any time and then may want the system to be immediately
5662306a36Sopenharmony_ciaccessible.
57