Documentation/admin-guide/pm/cpuidle.rst

Source file repositories/reference/linux-study-clean/Documentation/admin-guide/pm/cpuidle.rst

File Facts

System
Linux kernel
Corpus path
Documentation/admin-guide/pm/cpuidle.rst
Extension
.rst
Size
38655 bytes
Lines
667
Domain
Support Tooling And Documentation
Bucket
Documentation
Inferred role
Support Tooling And Documentation: documentation
Status
atlas-only

Why This File Exists

Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.

Dependency Surface

Detected Declarations

Annotated Snippet

.. SPDX-License-Identifier: GPL-2.0
.. include:: <isonum.txt>

.. |struct cpuidle_state| replace:: :c:type:`struct cpuidle_state <cpuidle_state>`
.. |cpufreq| replace:: :doc:`CPU Performance Scaling <cpufreq>`

========================
CPU Idle Time Management
========================

:Copyright: |copy| 2018 Intel Corporation

:Author: Rafael J. Wysocki <rafael.j.wysocki@intel.com>


Concepts
========

Modern processors are generally able to enter states in which the execution of
a program is suspended and instructions belonging to it are not fetched from
memory or executed.  Those states are the *idle* states of the processor.

Since part of the processor hardware is not used in idle states, entering them
generally allows power drawn by the processor to be reduced and, in consequence,
it is an opportunity to save energy.

CPU idle time management is an energy-efficiency feature concerned about using
the idle states of processors for this purpose.

Logical CPUs
------------

CPU idle time management operates on CPUs as seen by the *CPU scheduler* (that
is the part of the kernel responsible for the distribution of computational
work in the system).  In its view, CPUs are *logical* units.  That is, they need
not be separate physical entities and may just be interfaces appearing to
software as individual single-core processors.  In other words, a CPU is an
entity which appears to be fetching instructions that belong to one sequence
(program) from memory and executing them, but it need not work this way
physically.  Generally, three different cases can be consider here.

First, if the whole processor can only follow one sequence of instructions (one
program) at a time, it is a CPU.  In that case, if the hardware is asked to
enter an idle state, that applies to the processor as a whole.

Second, if the processor is multi-core, each core in it is able to follow at
least one program at a time.  The cores need not be entirely independent of each
other (for example, they may share caches), but still most of the time they
work physically in parallel with each other, so if each of them executes only
one program, those programs run mostly independently of each other at the same
time.  The entire cores are CPUs in that case and if the hardware is asked to
enter an idle state, that applies to the core that asked for it in the first
place, but it also may apply to a larger unit (say a "package" or a "cluster")
that the core belongs to (in fact, it may apply to an entire hierarchy of larger
units containing the core).  Namely, if all of the cores in the larger unit
except for one have been put into idle states at the "core level" and the
remaining core asks the processor to enter an idle state, that may trigger it
to put the whole larger unit into an idle state which also will affect the
other cores in that unit.

Finally, each core in a multi-core processor may be able to follow more than one
program in the same time frame (that is, each core may be able to fetch
instructions from multiple locations in memory and execute them in the same time
frame, but not necessarily entirely in parallel with each other).  In that case
the cores present themselves to software as "bundles" each consisting of
multiple individual single-core "processors", referred to as *hardware threads*
(or hyper-threads specifically on Intel hardware), that each can follow one
sequence of instructions.  Then, the hardware threads are CPUs from the CPU idle
time management perspective and if the processor is asked to enter an idle state
by one of them, the hardware thread (or CPU) that asked for it is stopped, but

Annotation

Implementation Notes