^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) .. SPDX-License-Identifier: GPL-2.0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) .. include:: <isonum.txt>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4) ===========================
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) Power Management Strategies
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) ===========================
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8) :Copyright: |copy| 2017 Intel Corporation
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) :Author: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) The Linux kernel supports two major high-level power management strategies.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) One of them is based on using global low-power states of the whole system in
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) which user space code cannot be executed and the overall system activity is
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) significantly reduced, referred to as :doc:`sleep states <sleep-states>`. The
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) kernel puts the system into one of these states when requested by user space
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) and the system stays in it until a special signal is received from one of
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) designated devices, triggering a transition to the ``working state`` in which
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) user space code can run. Because sleep states are global and the whole system
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) is affected by the state changes, this strategy is referred to as the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) :doc:`system-wide power management <system-wide>`.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) The other strategy, referred to as the :doc:`working-state power management
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) <working-state>`, is based on adjusting the power states of individual hardware
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) components of the system, as needed, in the working state. In consequence, if
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) this strategy is in use, the working state of the system usually does not
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) correspond to any particular physical configuration of it, but can be treated as
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) a metastate covering a range of different power states of the system in which
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) the individual components of it can be either ``active`` (in use) or
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) ``inactive`` (idle). If they are active, they have to be in power states
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) allowing them to process data and to be accessed by software. In turn, if they
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) are inactive, ideally, they should be in low-power states in which they may not
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) be accessible.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) If all of the system components are active, the system as a whole is regarded as
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) "runtime active" and that situation typically corresponds to the maximum power
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) draw (or maximum energy usage) of it. If all of them are inactive, the system
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) as a whole is regarded as "runtime idle" which may be very close to a sleep
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) state from the physical system configuration and power draw perspective, but
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) then it takes much less time and effort to start executing user space code than
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) for the same system in a sleep state. However, transitions from sleep states
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) back to the working state can only be started by a limited set of devices, so
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) typically the system can spend much more time in a sleep state than it can be
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) runtime idle in one go. For this reason, systems usually use less energy in
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) sleep states than when they are runtime idle most of the time.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) Moreover, the two power management strategies address different usage scenarios.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) Namely, if the user indicates that the system will not be in use going forward,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) for example by closing its lid (if the system is a laptop), it probably should
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) go into a sleep state at that point. On the other hand, if the user simply goes
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) away from the laptop keyboard, it probably should stay in the working state and
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) use the working-state power management in case it becomes idle, because the user
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) may come back to it at any time and then may want the system to be immediately
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) accessible.