~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/Documentation/admin-guide/pm/cpufreq.rst

Version: ~ [ linux-6.12-rc7 ] ~ [ linux-6.11.7 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.60 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.116 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.171 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.229 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.285 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.323 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.12 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

Diff markup

Differences between /Documentation/admin-guide/pm/cpufreq.rst (Version linux-6.12-rc7) and /Documentation/admin-guide/pm/cpufreq.rst (Version linux-4.13.16)


  1 .. SPDX-License-Identifier: GPL-2.0            !!   1 .. |struct cpufreq_policy| replace:: :c:type:`struct cpufreq_policy <cpufreq_policy>`
  2 .. include:: <isonum.txt>                      << 
  3                                                << 
  4 .. |intel_pstate| replace:: :doc:`intel_pstate      2 .. |intel_pstate| replace:: :doc:`intel_pstate <intel_pstate>`
  5                                                     3 
  6 =======================                             4 =======================
  7 CPU Performance Scaling                             5 CPU Performance Scaling
  8 =======================                             6 =======================
  9                                                     7 
 10 :Copyright: |copy| 2017 Intel Corporation      !!   8 ::
 11                                                << 
 12 :Author: Rafael J. Wysocki <rafael.j.wysocki@in << 
 13                                                     9 
                                                   >>  10  Copyright (c) 2017 Intel Corp., Rafael J. Wysocki <rafael.j.wysocki@intel.com>
 14                                                    11 
 15 The Concept of CPU Performance Scaling             12 The Concept of CPU Performance Scaling
 16 ======================================             13 ======================================
 17                                                    14 
 18 The majority of modern processors are capable      15 The majority of modern processors are capable of operating in a number of
 19 different clock frequency and voltage configur     16 different clock frequency and voltage configurations, often referred to as
 20 Operating Performance Points or P-states (in A     17 Operating Performance Points or P-states (in ACPI terminology).  As a rule,
 21 the higher the clock frequency and the higher      18 the higher the clock frequency and the higher the voltage, the more instructions
 22 can be retired by the CPU over a unit of time,     19 can be retired by the CPU over a unit of time, but also the higher the clock
 23 frequency and the higher the voltage, the more     20 frequency and the higher the voltage, the more energy is consumed over a unit of
 24 time (or the more power is drawn) by the CPU i     21 time (or the more power is drawn) by the CPU in the given P-state.  Therefore
 25 there is a natural tradeoff between the CPU ca     22 there is a natural tradeoff between the CPU capacity (the number of instructions
 26 that can be executed over a unit of time) and      23 that can be executed over a unit of time) and the power drawn by the CPU.
 27                                                    24 
 28 In some situations it is desirable or even nec     25 In some situations it is desirable or even necessary to run the program as fast
 29 as possible and then there is no reason to use     26 as possible and then there is no reason to use any P-states different from the
 30 highest one (i.e. the highest-performance freq     27 highest one (i.e. the highest-performance frequency/voltage configuration
 31 available).  In some other cases, however, it      28 available).  In some other cases, however, it may not be necessary to execute
 32 instructions so quickly and maintaining the hi     29 instructions so quickly and maintaining the highest available CPU capacity for a
 33 relatively long time without utilizing it enti     30 relatively long time without utilizing it entirely may be regarded as wasteful.
 34 It also may not be physically possible to main     31 It also may not be physically possible to maintain maximum CPU capacity for too
 35 long for thermal or power supply capacity reas     32 long for thermal or power supply capacity reasons or similar.  To cover those
 36 cases, there are hardware interfaces allowing      33 cases, there are hardware interfaces allowing CPUs to be switched between
 37 different frequency/voltage configurations or      34 different frequency/voltage configurations or (in the ACPI terminology) to be
 38 put into different P-states.                       35 put into different P-states.
 39                                                    36 
 40 Typically, they are used along with algorithms     37 Typically, they are used along with algorithms to estimate the required CPU
 41 capacity, so as to decide which P-states to pu     38 capacity, so as to decide which P-states to put the CPUs into.  Of course, since
 42 the utilization of the system generally change     39 the utilization of the system generally changes over time, that has to be done
 43 repeatedly on a regular basis.  The activity b     40 repeatedly on a regular basis.  The activity by which this happens is referred
 44 to as CPU performance scaling or CPU frequency     41 to as CPU performance scaling or CPU frequency scaling (because it involves
 45 adjusting the CPU clock frequency).                42 adjusting the CPU clock frequency).
 46                                                    43 
 47                                                    44 
 48 CPU Performance Scaling in Linux                   45 CPU Performance Scaling in Linux
 49 ================================                   46 ================================
 50                                                    47 
 51 The Linux kernel supports CPU performance scal     48 The Linux kernel supports CPU performance scaling by means of the ``CPUFreq``
 52 (CPU Frequency scaling) subsystem that consist     49 (CPU Frequency scaling) subsystem that consists of three layers of code: the
 53 core, scaling governors and scaling drivers.       50 core, scaling governors and scaling drivers.
 54                                                    51 
 55 The ``CPUFreq`` core provides the common code      52 The ``CPUFreq`` core provides the common code infrastructure and user space
 56 interfaces for all platforms that support CPU      53 interfaces for all platforms that support CPU performance scaling.  It defines
 57 the basic framework in which the other compone     54 the basic framework in which the other components operate.
 58                                                    55 
 59 Scaling governors implement algorithms to esti     56 Scaling governors implement algorithms to estimate the required CPU capacity.
 60 As a rule, each governor implements one, possi     57 As a rule, each governor implements one, possibly parametrized, scaling
 61 algorithm.                                         58 algorithm.
 62                                                    59 
 63 Scaling drivers talk to the hardware.  They pr     60 Scaling drivers talk to the hardware.  They provide scaling governors with
 64 information on the available P-states (or P-st     61 information on the available P-states (or P-state ranges in some cases) and
 65 access platform-specific hardware interfaces t     62 access platform-specific hardware interfaces to change CPU P-states as requested
 66 by scaling governors.                              63 by scaling governors.
 67                                                    64 
 68 In principle, all available scaling governors      65 In principle, all available scaling governors can be used with every scaling
 69 driver.  That design is based on the observati     66 driver.  That design is based on the observation that the information used by
 70 performance scaling algorithms for P-state sel     67 performance scaling algorithms for P-state selection can be represented in a
 71 platform-independent form in the majority of c     68 platform-independent form in the majority of cases, so it should be possible
 72 to use the same performance scaling algorithm      69 to use the same performance scaling algorithm implemented in exactly the same
 73 way regardless of which scaling driver is used     70 way regardless of which scaling driver is used.  Consequently, the same set of
 74 scaling governors should be suitable for every     71 scaling governors should be suitable for every supported platform.
 75                                                    72 
 76 However, that observation may not hold for per     73 However, that observation may not hold for performance scaling algorithms
 77 based on information provided by the hardware      74 based on information provided by the hardware itself, for example through
 78 feedback registers, as that information is typ     75 feedback registers, as that information is typically specific to the hardware
 79 interface it comes from and may not be easily      76 interface it comes from and may not be easily represented in an abstract,
 80 platform-independent way.  For this reason, ``     77 platform-independent way.  For this reason, ``CPUFreq`` allows scaling drivers
 81 to bypass the governor layer and implement the     78 to bypass the governor layer and implement their own performance scaling
 82 algorithms.  That is done by the |intel_pstate     79 algorithms.  That is done by the |intel_pstate| scaling driver.
 83                                                    80 
 84                                                    81 
 85 ``CPUFreq`` Policy Objects                         82 ``CPUFreq`` Policy Objects
 86 ==========================                         83 ==========================
 87                                                    84 
 88 In some cases the hardware interface for P-sta     85 In some cases the hardware interface for P-state control is shared by multiple
 89 CPUs.  That is, for example, the same register     86 CPUs.  That is, for example, the same register (or set of registers) is used to
 90 control the P-state of multiple CPUs at the sa     87 control the P-state of multiple CPUs at the same time and writing to it affects
 91 all of those CPUs simultaneously.                  88 all of those CPUs simultaneously.
 92                                                    89 
 93 Sets of CPUs sharing hardware P-state control      90 Sets of CPUs sharing hardware P-state control interfaces are represented by
 94 ``CPUFreq`` as struct cpufreq_policy objects.  !!  91 ``CPUFreq`` as |struct cpufreq_policy| objects.  For consistency,
 95 struct cpufreq_policy is also used when there  !!  92 |struct cpufreq_policy| is also used when there is only one CPU in the given
 96 set.                                               93 set.
 97                                                    94 
 98 The ``CPUFreq`` core maintains a pointer to a  !!  95 The ``CPUFreq`` core maintains a pointer to a |struct cpufreq_policy| object for
 99 every CPU in the system, including CPUs that a     96 every CPU in the system, including CPUs that are currently offline.  If multiple
100 CPUs share the same hardware P-state control i     97 CPUs share the same hardware P-state control interface, all of the pointers
101 corresponding to them point to the same struct !!  98 corresponding to them point to the same |struct cpufreq_policy| object.
102                                                    99 
103 ``CPUFreq`` uses struct cpufreq_policy as its  !! 100 ``CPUFreq`` uses |struct cpufreq_policy| as its basic data type and the design
104 of its user space interface is based on the po    101 of its user space interface is based on the policy concept.
105                                                   102 
106                                                   103 
107 CPU Initialization                                104 CPU Initialization
108 ==================                                105 ==================
109                                                   106 
110 First of all, a scaling driver has to be regis    107 First of all, a scaling driver has to be registered for ``CPUFreq`` to work.
111 It is only possible to register one scaling dr    108 It is only possible to register one scaling driver at a time, so the scaling
112 driver is expected to be able to handle all CP    109 driver is expected to be able to handle all CPUs in the system.
113                                                   110 
114 The scaling driver may be registered before or    111 The scaling driver may be registered before or after CPU registration.  If
115 CPUs are registered earlier, the driver core i    112 CPUs are registered earlier, the driver core invokes the ``CPUFreq`` core to
116 take a note of all of the already registered C    113 take a note of all of the already registered CPUs during the registration of the
117 scaling driver.  In turn, if any CPUs are regi    114 scaling driver.  In turn, if any CPUs are registered after the registration of
118 the scaling driver, the ``CPUFreq`` core will     115 the scaling driver, the ``CPUFreq`` core will be invoked to take note of them
119 at their registration time.                       116 at their registration time.
120                                                   117 
121 In any case, the ``CPUFreq`` core is invoked t    118 In any case, the ``CPUFreq`` core is invoked to take note of any logical CPU it
122 has not seen so far as soon as it is ready to     119 has not seen so far as soon as it is ready to handle that CPU.  [Note that the
123 logical CPU may be a physical single-core proc    120 logical CPU may be a physical single-core processor, or a single core in a
124 multicore processor, or a hardware thread in a    121 multicore processor, or a hardware thread in a physical processor or processor
125 core.  In what follows "CPU" always means "log    122 core.  In what follows "CPU" always means "logical CPU" unless explicitly stated
126 otherwise and the word "processor" is used to     123 otherwise and the word "processor" is used to refer to the physical part
127 possibly including multiple logical CPUs.]        124 possibly including multiple logical CPUs.]
128                                                   125 
129 Once invoked, the ``CPUFreq`` core checks if t    126 Once invoked, the ``CPUFreq`` core checks if the policy pointer is already set
130 for the given CPU and if so, it skips the poli    127 for the given CPU and if so, it skips the policy object creation.  Otherwise,
131 a new policy object is created and initialized    128 a new policy object is created and initialized, which involves the creation of
132 a new policy directory in ``sysfs``, and the p    129 a new policy directory in ``sysfs``, and the policy pointer corresponding to
133 the given CPU is set to the new policy object'    130 the given CPU is set to the new policy object's address in memory.
134                                                   131 
135 Next, the scaling driver's ``->init()`` callba    132 Next, the scaling driver's ``->init()`` callback is invoked with the policy
136 pointer of the new CPU passed to it as the arg    133 pointer of the new CPU passed to it as the argument.  That callback is expected
137 to initialize the performance scaling hardware    134 to initialize the performance scaling hardware interface for the given CPU (or,
138 more precisely, for the set of CPUs sharing th    135 more precisely, for the set of CPUs sharing the hardware interface it belongs
139 to, represented by its policy object) and, if     136 to, represented by its policy object) and, if the policy object it has been
140 called for is new, to set parameters of the po    137 called for is new, to set parameters of the policy, like the minimum and maximum
141 frequencies supported by the hardware, the tab    138 frequencies supported by the hardware, the table of available frequencies (if
142 the set of supported P-states is not a continu    139 the set of supported P-states is not a continuous range), and the mask of CPUs
143 that belong to the same policy (including both    140 that belong to the same policy (including both online and offline CPUs).  That
144 mask is then used by the core to populate the     141 mask is then used by the core to populate the policy pointers for all of the
145 CPUs in it.                                       142 CPUs in it.
146                                                   143 
147 The next major initialization step for a new p    144 The next major initialization step for a new policy object is to attach a
148 scaling governor to it (to begin with, that is    145 scaling governor to it (to begin with, that is the default scaling governor
149 determined by the kernel command line or confi !! 146 determined by the kernel configuration, but it may be changed later
150 later via ``sysfs``).  First, a pointer to the !! 147 via ``sysfs``).  First, a pointer to the new policy object is passed to the
151 the governor's ``->init()`` callback which is  !! 148 governor's ``->init()`` callback which is expected to initialize all of the
152 data structures necessary to handle the given     149 data structures necessary to handle the given policy and, possibly, to add
153 a governor ``sysfs`` interface to it.  Next, t    150 a governor ``sysfs`` interface to it.  Next, the governor is started by
154 invoking its ``->start()`` callback.              151 invoking its ``->start()`` callback.
155                                                   152 
156 That callback is expected to register per-CPU  !! 153 That callback it expected to register per-CPU utilization update callbacks for
157 all of the online CPUs belonging to the given     154 all of the online CPUs belonging to the given policy with the CPU scheduler.
158 The utilization update callbacks will be invok    155 The utilization update callbacks will be invoked by the CPU scheduler on
159 important events, like task enqueue and dequeu    156 important events, like task enqueue and dequeue, on every iteration of the
160 scheduler tick or generally whenever the CPU u    157 scheduler tick or generally whenever the CPU utilization may change (from the
161 scheduler's perspective).  They are expected t    158 scheduler's perspective).  They are expected to carry out computations needed
162 to determine the P-state to use for the given     159 to determine the P-state to use for the given policy going forward and to
163 invoke the scaling driver to make changes to t    160 invoke the scaling driver to make changes to the hardware in accordance with
164 the P-state selection.  The scaling driver may    161 the P-state selection.  The scaling driver may be invoked directly from
165 scheduler context or asynchronously, via a ker    162 scheduler context or asynchronously, via a kernel thread or workqueue, depending
166 on the configuration and capabilities of the s    163 on the configuration and capabilities of the scaling driver and the governor.
167                                                   164 
168 Similar steps are taken for policy objects tha    165 Similar steps are taken for policy objects that are not new, but were "inactive"
169 previously, meaning that all of the CPUs belon    166 previously, meaning that all of the CPUs belonging to them were offline.  The
170 only practical difference in that case is that    167 only practical difference in that case is that the ``CPUFreq`` core will attempt
171 to use the scaling governor previously used wi    168 to use the scaling governor previously used with the policy that became
172 "inactive" (and is re-initialized now) instead    169 "inactive" (and is re-initialized now) instead of the default governor.
173                                                   170 
174 In turn, if a previously offline CPU is being     171 In turn, if a previously offline CPU is being brought back online, but some
175 other CPUs sharing the policy object with it a    172 other CPUs sharing the policy object with it are online already, there is no
176 need to re-initialize the policy object at all    173 need to re-initialize the policy object at all.  In that case, it only is
177 necessary to restart the scaling governor so t    174 necessary to restart the scaling governor so that it can take the new online CPU
178 into account.  That is achieved by invoking th    175 into account.  That is achieved by invoking the governor's ``->stop`` and
179 ``->start()`` callbacks, in this order, for th    176 ``->start()`` callbacks, in this order, for the entire policy.
180                                                   177 
181 As mentioned before, the |intel_pstate| scalin    178 As mentioned before, the |intel_pstate| scaling driver bypasses the scaling
182 governor layer of ``CPUFreq`` and provides its    179 governor layer of ``CPUFreq`` and provides its own P-state selection algorithms.
183 Consequently, if |intel_pstate| is used, scali    180 Consequently, if |intel_pstate| is used, scaling governors are not attached to
184 new policy objects.  Instead, the driver's ``-    181 new policy objects.  Instead, the driver's ``->setpolicy()`` callback is invoked
185 to register per-CPU utilization update callbac    182 to register per-CPU utilization update callbacks for each policy.  These
186 callbacks are invoked by the CPU scheduler in     183 callbacks are invoked by the CPU scheduler in the same way as for scaling
187 governors, but in the |intel_pstate| case they    184 governors, but in the |intel_pstate| case they both determine the P-state to
188 use and change the hardware configuration acco    185 use and change the hardware configuration accordingly in one go from scheduler
189 context.                                          186 context.
190                                                   187 
191 The policy objects created during CPU initiali    188 The policy objects created during CPU initialization and other data structures
192 associated with them are torn down when the sc    189 associated with them are torn down when the scaling driver is unregistered
193 (which happens when the kernel module containi    190 (which happens when the kernel module containing it is unloaded, for example) or
194 when the last CPU belonging to the given polic    191 when the last CPU belonging to the given policy in unregistered.
195                                                   192 
196                                                   193 
197 Policy Interface in ``sysfs``                     194 Policy Interface in ``sysfs``
198 =============================                     195 =============================
199                                                   196 
200 During the initialization of the kernel, the `    197 During the initialization of the kernel, the ``CPUFreq`` core creates a
201 ``sysfs`` directory (kobject) called ``cpufreq    198 ``sysfs`` directory (kobject) called ``cpufreq`` under
202 :file:`/sys/devices/system/cpu/`.                 199 :file:`/sys/devices/system/cpu/`.
203                                                   200 
204 That directory contains a ``policyX`` subdirec    201 That directory contains a ``policyX`` subdirectory (where ``X`` represents an
205 integer number) for every policy object mainta    202 integer number) for every policy object maintained by the ``CPUFreq`` core.
206 Each ``policyX`` directory is pointed to by ``    203 Each ``policyX`` directory is pointed to by ``cpufreq`` symbolic links
207 under :file:`/sys/devices/system/cpu/cpuY/` (w    204 under :file:`/sys/devices/system/cpu/cpuY/` (where ``Y`` represents an integer
208 that may be different from the one represented    205 that may be different from the one represented by ``X``) for all of the CPUs
209 associated with (or belonging to) the given po    206 associated with (or belonging to) the given policy.  The ``policyX`` directories
210 in :file:`/sys/devices/system/cpu/cpufreq` eac    207 in :file:`/sys/devices/system/cpu/cpufreq` each contain policy-specific
211 attributes (files) to control ``CPUFreq`` beha    208 attributes (files) to control ``CPUFreq`` behavior for the corresponding policy
212 objects (that is, for all of the CPUs associat    209 objects (that is, for all of the CPUs associated with them).
213                                                   210 
214 Some of those attributes are generic.  They ar    211 Some of those attributes are generic.  They are created by the ``CPUFreq`` core
215 and their behavior generally does not depend o    212 and their behavior generally does not depend on what scaling driver is in use
216 and what scaling governor is attached to the g    213 and what scaling governor is attached to the given policy.  Some scaling drivers
217 also add driver-specific attributes to the pol    214 also add driver-specific attributes to the policy directories in ``sysfs`` to
218 control policy-specific aspects of driver beha    215 control policy-specific aspects of driver behavior.
219                                                   216 
220 The generic attributes under :file:`/sys/devic    217 The generic attributes under :file:`/sys/devices/system/cpu/cpufreq/policyX/`
221 are the following:                                218 are the following:
222                                                   219 
223 ``affected_cpus``                                 220 ``affected_cpus``
224         List of online CPUs belonging to this     221         List of online CPUs belonging to this policy (i.e. sharing the hardware
225         performance scaling interface represen    222         performance scaling interface represented by the ``policyX`` policy
226         object).                                  223         object).
227                                                   224 
228 ``bios_limit``                                    225 ``bios_limit``
229         If the platform firmware (BIOS) tells     226         If the platform firmware (BIOS) tells the OS to apply an upper limit to
230         CPU frequencies, that limit will be re    227         CPU frequencies, that limit will be reported through this attribute (if
231         present).                                 228         present).
232                                                   229 
233         The existence of the limit may be a re    230         The existence of the limit may be a result of some (often unintentional)
234         BIOS settings, restrictions coming fro    231         BIOS settings, restrictions coming from a service processor or another
235         BIOS/HW-based mechanisms.                 232         BIOS/HW-based mechanisms.
236                                                   233 
237         This does not cover ACPI thermal limit    234         This does not cover ACPI thermal limitations which can be discovered
238         through a generic thermal driver.         235         through a generic thermal driver.
239                                                   236 
240         This attribute is not present if the s    237         This attribute is not present if the scaling driver in use does not
241         support it.                               238         support it.
242                                                   239 
243 ``cpuinfo_cur_freq``                              240 ``cpuinfo_cur_freq``
244         Current frequency of the CPUs belongin    241         Current frequency of the CPUs belonging to this policy as obtained from
245         the hardware (in KHz).                    242         the hardware (in KHz).
246                                                   243 
247         This is expected to be the frequency t    244         This is expected to be the frequency the hardware actually runs at.
248         If that frequency cannot be determined    245         If that frequency cannot be determined, this attribute should not
249         be present.                               246         be present.
250                                                   247 
251 ``cpuinfo_max_freq``                              248 ``cpuinfo_max_freq``
252         Maximum possible operating frequency t    249         Maximum possible operating frequency the CPUs belonging to this policy
253         can run at (in kHz).                      250         can run at (in kHz).
254                                                   251 
255 ``cpuinfo_min_freq``                              252 ``cpuinfo_min_freq``
256         Minimum possible operating frequency t    253         Minimum possible operating frequency the CPUs belonging to this policy
257         can run at (in kHz).                      254         can run at (in kHz).
258                                                   255 
259 ``cpuinfo_transition_latency``                    256 ``cpuinfo_transition_latency``
260         The time it takes to switch the CPUs b    257         The time it takes to switch the CPUs belonging to this policy from one
261         P-state to another, in nanoseconds.       258         P-state to another, in nanoseconds.
262                                                   259 
263         If unknown or if known to be so high t    260         If unknown or if known to be so high that the scaling driver does not
264         work with the `ondemand`_ governor, -1    261         work with the `ondemand`_ governor, -1 (:c:macro:`CPUFREQ_ETERNAL`)
265         will be returned by reads from this at    262         will be returned by reads from this attribute.
266                                                   263 
267 ``related_cpus``                                  264 ``related_cpus``
268         List of all (online and offline) CPUs     265         List of all (online and offline) CPUs belonging to this policy.
269                                                   266 
270 ``scaling_available_frequencies``              << 
271         List of available frequencies of the C << 
272         (in kHz).                              << 
273                                                << 
274 ``scaling_available_governors``                   267 ``scaling_available_governors``
275         List of ``CPUFreq`` scaling governors     268         List of ``CPUFreq`` scaling governors present in the kernel that can
276         be attached to this policy or (if the     269         be attached to this policy or (if the |intel_pstate| scaling driver is
277         in use) list of scaling algorithms pro    270         in use) list of scaling algorithms provided by the driver that can be
278         applied to this policy.                   271         applied to this policy.
279                                                   272 
280         [Note that some governors are modular     273         [Note that some governors are modular and it may be necessary to load a
281         kernel module for the governor held by    274         kernel module for the governor held by it to become available and be
282         listed by this attribute.]                275         listed by this attribute.]
283                                                   276 
284 ``scaling_cur_freq``                              277 ``scaling_cur_freq``
285         Current frequency of all of the CPUs b    278         Current frequency of all of the CPUs belonging to this policy (in kHz).
286                                                   279 
287         In the majority of cases, this is the     280         In the majority of cases, this is the frequency of the last P-state
288         requested by the scaling driver from t    281         requested by the scaling driver from the hardware using the scaling
289         interface provided by it, which may or    282         interface provided by it, which may or may not reflect the frequency
290         the CPU is actually running at (due to    283         the CPU is actually running at (due to hardware design and other
291         limitations).                             284         limitations).
292                                                   285 
293         Some architectures (e.g. ``x86``) may     286         Some architectures (e.g. ``x86``) may attempt to provide information
294         more precisely reflecting the current     287         more precisely reflecting the current CPU frequency through this
295         attribute, but that still may not be t    288         attribute, but that still may not be the exact current CPU frequency as
296         seen by the hardware at the moment.       289         seen by the hardware at the moment.
297                                                   290 
298 ``scaling_driver``                                291 ``scaling_driver``
299         The scaling driver currently in use.      292         The scaling driver currently in use.
300                                                   293 
301 ``scaling_governor``                              294 ``scaling_governor``
302         The scaling governor currently attache    295         The scaling governor currently attached to this policy or (if the
303         |intel_pstate| scaling driver is in us    296         |intel_pstate| scaling driver is in use) the scaling algorithm
304         provided by the driver that is current    297         provided by the driver that is currently applied to this policy.
305                                                   298 
306         This attribute is read-write and writi    299         This attribute is read-write and writing to it will cause a new scaling
307         governor to be attached to this policy    300         governor to be attached to this policy or a new scaling algorithm
308         provided by the scaling driver to be a    301         provided by the scaling driver to be applied to it (in the
309         |intel_pstate| case), as indicated by     302         |intel_pstate| case), as indicated by the string written to this
310         attribute (which must be one of the na    303         attribute (which must be one of the names listed by the
311         ``scaling_available_governors`` attrib    304         ``scaling_available_governors`` attribute described above).
312                                                   305 
313 ``scaling_max_freq``                              306 ``scaling_max_freq``
314         Maximum frequency the CPUs belonging t    307         Maximum frequency the CPUs belonging to this policy are allowed to be
315         running at (in kHz).                      308         running at (in kHz).
316                                                   309 
317         This attribute is read-write and writi    310         This attribute is read-write and writing a string representing an
318         integer to it will cause a new limit t    311         integer to it will cause a new limit to be set (it must not be lower
319         than the value of the ``scaling_min_fr    312         than the value of the ``scaling_min_freq`` attribute).
320                                                   313 
321 ``scaling_min_freq``                              314 ``scaling_min_freq``
322         Minimum frequency the CPUs belonging t    315         Minimum frequency the CPUs belonging to this policy are allowed to be
323         running at (in kHz).                      316         running at (in kHz).
324                                                   317 
325         This attribute is read-write and writi    318         This attribute is read-write and writing a string representing a
326         non-negative integer to it will cause     319         non-negative integer to it will cause a new limit to be set (it must not
327         be higher than the value of the ``scal    320         be higher than the value of the ``scaling_max_freq`` attribute).
328                                                   321 
329 ``scaling_setspeed``                              322 ``scaling_setspeed``
330         This attribute is functional only if t    323         This attribute is functional only if the `userspace`_ scaling governor
331         is attached to the given policy.          324         is attached to the given policy.
332                                                   325 
333         It returns the last frequency requeste    326         It returns the last frequency requested by the governor (in kHz) or can
334         be written to in order to set a new fr    327         be written to in order to set a new frequency for the policy.
335                                                   328 
336                                                   329 
337 Generic Scaling Governors                         330 Generic Scaling Governors
338 =========================                         331 =========================
339                                                   332 
340 ``CPUFreq`` provides generic scaling governors    333 ``CPUFreq`` provides generic scaling governors that can be used with all
341 scaling drivers.  As stated before, each of th    334 scaling drivers.  As stated before, each of them implements a single, possibly
342 parametrized, performance scaling algorithm.      335 parametrized, performance scaling algorithm.
343                                                   336 
344 Scaling governors are attached to policy objec    337 Scaling governors are attached to policy objects and different policy objects
345 can be handled by different scaling governors     338 can be handled by different scaling governors at the same time (although that
346 may lead to suboptimal results in some cases).    339 may lead to suboptimal results in some cases).
347                                                   340 
348 The scaling governor for a given policy object    341 The scaling governor for a given policy object can be changed at any time with
349 the help of the ``scaling_governor`` policy at    342 the help of the ``scaling_governor`` policy attribute in ``sysfs``.
350                                                   343 
351 Some governors expose ``sysfs`` attributes to     344 Some governors expose ``sysfs`` attributes to control or fine-tune the scaling
352 algorithms implemented by them.  Those attribu    345 algorithms implemented by them.  Those attributes, referred to as governor
353 tunables, can be either global (system-wide) o    346 tunables, can be either global (system-wide) or per-policy, depending on the
354 scaling driver in use.  If the driver requires    347 scaling driver in use.  If the driver requires governor tunables to be
355 per-policy, they are located in a subdirectory    348 per-policy, they are located in a subdirectory of each policy directory.
356 Otherwise, they are located in a subdirectory     349 Otherwise, they are located in a subdirectory under
357 :file:`/sys/devices/system/cpu/cpufreq/`.  In     350 :file:`/sys/devices/system/cpu/cpufreq/`.  In either case the name of the
358 subdirectory containing the governor tunables     351 subdirectory containing the governor tunables is the name of the governor
359 providing them.                                   352 providing them.
360                                                   353 
361 ``performance``                                   354 ``performance``
362 ---------------                                   355 ---------------
363                                                   356 
364 When attached to a policy object, this governo    357 When attached to a policy object, this governor causes the highest frequency,
365 within the ``scaling_max_freq`` policy limit,     358 within the ``scaling_max_freq`` policy limit, to be requested for that policy.
366                                                   359 
367 The request is made once at that time the gove    360 The request is made once at that time the governor for the policy is set to
368 ``performance`` and whenever the ``scaling_max    361 ``performance`` and whenever the ``scaling_max_freq`` or ``scaling_min_freq``
369 policy limits change after that.                  362 policy limits change after that.
370                                                   363 
371 ``powersave``                                     364 ``powersave``
372 -------------                                     365 -------------
373                                                   366 
374 When attached to a policy object, this governo    367 When attached to a policy object, this governor causes the lowest frequency,
375 within the ``scaling_min_freq`` policy limit,     368 within the ``scaling_min_freq`` policy limit, to be requested for that policy.
376                                                   369 
377 The request is made once at that time the gove    370 The request is made once at that time the governor for the policy is set to
378 ``powersave`` and whenever the ``scaling_max_f    371 ``powersave`` and whenever the ``scaling_max_freq`` or ``scaling_min_freq``
379 policy limits change after that.                  372 policy limits change after that.
380                                                   373 
381 ``userspace``                                     374 ``userspace``
382 -------------                                     375 -------------
383                                                   376 
384 This governor does not do anything by itself.     377 This governor does not do anything by itself.  Instead, it allows user space
385 to set the CPU frequency for the policy it is     378 to set the CPU frequency for the policy it is attached to by writing to the
386 ``scaling_setspeed`` attribute of that policy.    379 ``scaling_setspeed`` attribute of that policy.
387                                                   380 
388 ``schedutil``                                     381 ``schedutil``
389 -------------                                     382 -------------
390                                                   383 
391 This governor uses CPU utilization data availa    384 This governor uses CPU utilization data available from the CPU scheduler.  It
392 generally is regarded as a part of the CPU sch    385 generally is regarded as a part of the CPU scheduler, so it can access the
393 scheduler's internal data structures directly.    386 scheduler's internal data structures directly.
394                                                   387 
395 It runs entirely in scheduler context, althoug    388 It runs entirely in scheduler context, although in some cases it may need to
396 invoke the scaling driver asynchronously when     389 invoke the scaling driver asynchronously when it decides that the CPU frequency
397 should be changed for a given policy (that dep    390 should be changed for a given policy (that depends on whether or not the driver
398 is capable of changing the CPU frequency from     391 is capable of changing the CPU frequency from scheduler context).
399                                                   392 
400 The actions of this governor for a particular     393 The actions of this governor for a particular CPU depend on the scheduling class
401 invoking its utilization update callback for t    394 invoking its utilization update callback for that CPU.  If it is invoked by the
402 RT or deadline scheduling classes, the governo    395 RT or deadline scheduling classes, the governor will increase the frequency to
403 the allowed maximum (that is, the ``scaling_ma    396 the allowed maximum (that is, the ``scaling_max_freq`` policy limit).  In turn,
404 if it is invoked by the CFS scheduling class,     397 if it is invoked by the CFS scheduling class, the governor will use the
405 Per-Entity Load Tracking (PELT) metric for the    398 Per-Entity Load Tracking (PELT) metric for the root control group of the
406 given CPU as the CPU utilization estimate (see !! 399 given CPU as the CPU utilization estimate (see the `Per-entity load tracking`_
407 LWN.net article [1]_ for a description of the  !! 400 LWN.net article for a description of the PELT mechanism).  Then, the new
408 CPU frequency to apply is computed in accordan    401 CPU frequency to apply is computed in accordance with the formula
409                                                   402 
410         f = 1.25 * ``f_0`` * ``util`` / ``max`    403         f = 1.25 * ``f_0`` * ``util`` / ``max``
411                                                   404 
412 where ``util`` is the PELT number, ``max`` is     405 where ``util`` is the PELT number, ``max`` is the theoretical maximum of
413 ``util``, and ``f_0`` is either the maximum po    406 ``util``, and ``f_0`` is either the maximum possible CPU frequency for the given
414 policy (if the PELT number is frequency-invari    407 policy (if the PELT number is frequency-invariant), or the current CPU frequency
415 (otherwise).                                      408 (otherwise).
416                                                   409 
417 This governor also employs a mechanism allowin    410 This governor also employs a mechanism allowing it to temporarily bump up the
418 CPU frequency for tasks that have been waiting    411 CPU frequency for tasks that have been waiting on I/O most recently, called
419 "IO-wait boosting".  That happens when the :c:    412 "IO-wait boosting".  That happens when the :c:macro:`SCHED_CPUFREQ_IOWAIT` flag
420 is passed by the scheduler to the governor cal    413 is passed by the scheduler to the governor callback which causes the frequency
421 to go up to the allowed maximum immediately an    414 to go up to the allowed maximum immediately and then draw back to the value
422 returned by the above formula over time.          415 returned by the above formula over time.
423                                                   416 
424 This governor exposes only one tunable:           417 This governor exposes only one tunable:
425                                                   418 
426 ``rate_limit_us``                                 419 ``rate_limit_us``
427         Minimum time (in microseconds) that ha    420         Minimum time (in microseconds) that has to pass between two consecutive
428         runs of governor computations (default !! 421         runs of governor computations (default: 1000 times the scaling driver's
429         transition latency or the maximum 2ms) !! 422         transition latency).
430                                                   423 
431         The purpose of this tunable is to redu    424         The purpose of this tunable is to reduce the scheduler context overhead
432         of the governor which might be excessi    425         of the governor which might be excessive without it.
433                                                   426 
434 This governor generally is regarded as a repla    427 This governor generally is regarded as a replacement for the older `ondemand`_
435 and `conservative`_ governors (described below    428 and `conservative`_ governors (described below), as it is simpler and more
436 tightly integrated with the CPU scheduler, its    429 tightly integrated with the CPU scheduler, its overhead in terms of CPU context
437 switches and similar is less significant, and     430 switches and similar is less significant, and it uses the scheduler's own CPU
438 utilization metric, so in principle its decisi    431 utilization metric, so in principle its decisions should not contradict the
439 decisions made by the other parts of the sched    432 decisions made by the other parts of the scheduler.
440                                                   433 
441 ``ondemand``                                      434 ``ondemand``
442 ------------                                      435 ------------
443                                                   436 
444 This governor uses CPU load as a CPU frequency    437 This governor uses CPU load as a CPU frequency selection metric.
445                                                   438 
446 In order to estimate the current CPU load, it     439 In order to estimate the current CPU load, it measures the time elapsed between
447 consecutive invocations of its worker routine     440 consecutive invocations of its worker routine and computes the fraction of that
448 time in which the given CPU was not idle.  The    441 time in which the given CPU was not idle.  The ratio of the non-idle (active)
449 time to the total CPU time is taken as an esti    442 time to the total CPU time is taken as an estimate of the load.
450                                                   443 
451 If this governor is attached to a policy share    444 If this governor is attached to a policy shared by multiple CPUs, the load is
452 estimated for all of them and the greatest res    445 estimated for all of them and the greatest result is taken as the load estimate
453 for the entire policy.                            446 for the entire policy.
454                                                   447 
455 The worker routine of this governor has to run    448 The worker routine of this governor has to run in process context, so it is
456 invoked asynchronously (via a workqueue) and C    449 invoked asynchronously (via a workqueue) and CPU P-states are updated from
457 there if necessary.  As a result, the schedule    450 there if necessary.  As a result, the scheduler context overhead from this
458 governor is minimum, but it causes additional     451 governor is minimum, but it causes additional CPU context switches to happen
459 relatively often and the CPU P-state updates t    452 relatively often and the CPU P-state updates triggered by it can be relatively
460 irregular.  Also, it affects its own CPU load     453 irregular.  Also, it affects its own CPU load metric by running code that
461 reduces the CPU idle time (even though the CPU    454 reduces the CPU idle time (even though the CPU idle time is only reduced very
462 slightly by it).                                  455 slightly by it).
463                                                   456 
464 It generally selects CPU frequencies proportio    457 It generally selects CPU frequencies proportional to the estimated load, so that
465 the value of the ``cpuinfo_max_freq`` policy a    458 the value of the ``cpuinfo_max_freq`` policy attribute corresponds to the load of
466 1 (or 100%), and the value of the ``cpuinfo_mi    459 1 (or 100%), and the value of the ``cpuinfo_min_freq`` policy attribute
467 corresponds to the load of 0, unless when the     460 corresponds to the load of 0, unless when the load exceeds a (configurable)
468 speedup threshold, in which case it will go st    461 speedup threshold, in which case it will go straight for the highest frequency
469 it is allowed to use (the ``scaling_max_freq``    462 it is allowed to use (the ``scaling_max_freq`` policy limit).
470                                                   463 
471 This governor exposes the following tunables:     464 This governor exposes the following tunables:
472                                                   465 
473 ``sampling_rate``                                 466 ``sampling_rate``
474         This is how often the governor's worke    467         This is how often the governor's worker routine should run, in
475         microseconds.                             468         microseconds.
476                                                   469 
477         Typically, it is set to values of the  !! 470         Typically, it is set to values of the order of 10000 (10 ms).  Its
478         default value is to add a 50% breathin !! 471         default value is equal to the value of ``cpuinfo_transition_latency``
479         to ``cpuinfo_transition_latency`` on e !! 472         for each policy this governor is attached to (but since the unit here
480         attached to. The minimum is typically  !! 473         is greater by 1000, this means that the time represented by
481         ticks.                                 !! 474         ``sampling_rate`` is 1000 times greater than the transition latency by
                                                   >> 475         default).
482                                                   476 
483         If this tunable is per-policy, the fol    477         If this tunable is per-policy, the following shell command sets the time
484         represented by it to be 1.5 times as h !! 478         represented by it to be 750 times as high as the transition latency::
485         (the default)::                        !! 479 
                                                   >> 480         # echo `$(($(cat cpuinfo_transition_latency) * 750 / 1000)) > ondemand/sampling_rate
486                                                   481 
487         # echo `$(($(cat cpuinfo_transition_la !! 482 
                                                   >> 483 ``min_sampling_rate``
                                                   >> 484         The minimum value of ``sampling_rate``.
                                                   >> 485 
                                                   >> 486         Equal to 10000 (10 ms) if :c:macro:`CONFIG_NO_HZ_COMMON` and
                                                   >> 487         :c:data:`tick_nohz_active` are both set or to 20 times the value of
                                                   >> 488         :c:data:`jiffies` in microseconds otherwise.
488                                                   489 
489 ``up_threshold``                                  490 ``up_threshold``
490         If the estimated CPU load is above thi    491         If the estimated CPU load is above this value (in percent), the governor
491         will set the frequency to the maximum     492         will set the frequency to the maximum value allowed for the policy.
492         Otherwise, the selected frequency will    493         Otherwise, the selected frequency will be proportional to the estimated
493         CPU load.                                 494         CPU load.
494                                                   495 
495 ``ignore_nice_load``                              496 ``ignore_nice_load``
496         If set to 1 (default 0), it will cause    497         If set to 1 (default 0), it will cause the CPU load estimation code to
497         treat the CPU time spent on executing     498         treat the CPU time spent on executing tasks with "nice" levels greater
498         than 0 as CPU idle time.                  499         than 0 as CPU idle time.
499                                                   500 
500         This may be useful if there are tasks     501         This may be useful if there are tasks in the system that should not be
501         taken into account when deciding what     502         taken into account when deciding what frequency to run the CPUs at.
502         Then, to make that happen it is suffic    503         Then, to make that happen it is sufficient to increase the "nice" level
503         of those tasks above 0 and set this at    504         of those tasks above 0 and set this attribute to 1.
504                                                   505 
505 ``sampling_down_factor``                          506 ``sampling_down_factor``
506         Temporary multiplier, between 1 (defau    507         Temporary multiplier, between 1 (default) and 100 inclusive, to apply to
507         the ``sampling_rate`` value if the CPU    508         the ``sampling_rate`` value if the CPU load goes above ``up_threshold``.
508                                                   509 
509         This causes the next execution of the     510         This causes the next execution of the governor's worker routine (after
510         setting the frequency to the allowed m    511         setting the frequency to the allowed maximum) to be delayed, so the
511         frequency stays at the maximum level f    512         frequency stays at the maximum level for a longer time.
512                                                   513 
513         Frequency fluctuations in some bursty     514         Frequency fluctuations in some bursty workloads may be avoided this way
514         at the cost of additional energy spent    515         at the cost of additional energy spent on maintaining the maximum CPU
515         capacity.                                 516         capacity.
516                                                   517 
517 ``powersave_bias``                                518 ``powersave_bias``
518         Reduction factor to apply to the origi    519         Reduction factor to apply to the original frequency target of the
519         governor (including the maximum value     520         governor (including the maximum value used when the ``up_threshold``
520         value is exceeded by the estimated CPU    521         value is exceeded by the estimated CPU load) or sensitivity threshold
521         for the AMD frequency sensitivity powe    522         for the AMD frequency sensitivity powersave bias driver
522         (:file:`drivers/cpufreq/amd_freq_sensi    523         (:file:`drivers/cpufreq/amd_freq_sensitivity.c`), between 0 and 1000
523         inclusive.                                524         inclusive.
524                                                   525 
525         If the AMD frequency sensitivity power    526         If the AMD frequency sensitivity powersave bias driver is not loaded,
526         the effective frequency to apply is gi    527         the effective frequency to apply is given by
527                                                   528 
528                 f * (1 - ``powersave_bias`` /     529                 f * (1 - ``powersave_bias`` / 1000)
529                                                   530 
530         where f is the governor's original fre    531         where f is the governor's original frequency target.  The default value
531         of this attribute is 0 in that case.      532         of this attribute is 0 in that case.
532                                                   533 
533         If the AMD frequency sensitivity power    534         If the AMD frequency sensitivity powersave bias driver is loaded, the
534         value of this attribute is 400 by defa    535         value of this attribute is 400 by default and it is used in a different
535         way.                                      536         way.
536                                                   537 
537         On Family 16h (and later) AMD processo    538         On Family 16h (and later) AMD processors there is a mechanism to get a
538         measured workload sensitivity, between    539         measured workload sensitivity, between 0 and 100% inclusive, from the
539         hardware.  That value can be used to e    540         hardware.  That value can be used to estimate how the performance of the
540         workload running on a CPU will change     541         workload running on a CPU will change in response to frequency changes.
541                                                   542 
542         The performance of a workload with the    543         The performance of a workload with the sensitivity of 0 (memory-bound or
543         IO-bound) is not expected to increase     544         IO-bound) is not expected to increase at all as a result of increasing
544         the CPU frequency, whereas workloads w    545         the CPU frequency, whereas workloads with the sensitivity of 100%
545         (CPU-bound) are expected to perform mu    546         (CPU-bound) are expected to perform much better if the CPU frequency is
546         increased.                                547         increased.
547                                                   548 
548         If the workload sensitivity is less th    549         If the workload sensitivity is less than the threshold represented by
549         the ``powersave_bias`` value, the sens    550         the ``powersave_bias`` value, the sensitivity powersave bias driver
550         will cause the governor to select a fr    551         will cause the governor to select a frequency lower than its original
551         target, so as to avoid over-provisioni    552         target, so as to avoid over-provisioning workloads that will not benefit
552         from running at higher CPU frequencies    553         from running at higher CPU frequencies.
553                                                   554 
554 ``conservative``                                  555 ``conservative``
555 ----------------                                  556 ----------------
556                                                   557 
557 This governor uses CPU load as a CPU frequency    558 This governor uses CPU load as a CPU frequency selection metric.
558                                                   559 
559 It estimates the CPU load in the same way as t    560 It estimates the CPU load in the same way as the `ondemand`_ governor described
560 above, but the CPU frequency selection algorit    561 above, but the CPU frequency selection algorithm implemented by it is different.
561                                                   562 
562 Namely, it avoids changing the frequency signi    563 Namely, it avoids changing the frequency significantly over short time intervals
563 which may not be suitable for systems with lim    564 which may not be suitable for systems with limited power supply capacity (e.g.
564 battery-powered).  To achieve that, it changes    565 battery-powered).  To achieve that, it changes the frequency in relatively
565 small steps, one step at a time, up or down -     566 small steps, one step at a time, up or down - depending on whether or not a
566 (configurable) threshold has been exceeded by     567 (configurable) threshold has been exceeded by the estimated CPU load.
567                                                   568 
568 This governor exposes the following tunables:     569 This governor exposes the following tunables:
569                                                   570 
570 ``freq_step``                                     571 ``freq_step``
571         Frequency step in percent of the maxim    572         Frequency step in percent of the maximum frequency the governor is
572         allowed to set (the ``scaling_max_freq    573         allowed to set (the ``scaling_max_freq`` policy limit), between 0 and
573         100 (5 by default).                       574         100 (5 by default).
574                                                   575 
575         This is how much the frequency is allo    576         This is how much the frequency is allowed to change in one go.  Setting
576         it to 0 will cause the default frequen    577         it to 0 will cause the default frequency step (5 percent) to be used
577         and setting it to 100 effectively caus    578         and setting it to 100 effectively causes the governor to periodically
578         switch the frequency between the ``sca    579         switch the frequency between the ``scaling_min_freq`` and
579         ``scaling_max_freq`` policy limits.       580         ``scaling_max_freq`` policy limits.
580                                                   581 
581 ``down_threshold``                                582 ``down_threshold``
582         Threshold value (in percent, 20 by def    583         Threshold value (in percent, 20 by default) used to determine the
583         frequency change direction.               584         frequency change direction.
584                                                   585 
585         If the estimated CPU load is greater t    586         If the estimated CPU load is greater than this value, the frequency will
586         go up (by ``freq_step``).  If the load    587         go up (by ``freq_step``).  If the load is less than this value (and the
587         ``sampling_down_factor`` mechanism is     588         ``sampling_down_factor`` mechanism is not in effect), the frequency will
588         go down.  Otherwise, the frequency wil    589         go down.  Otherwise, the frequency will not be changed.
589                                                   590 
590 ``sampling_down_factor``                          591 ``sampling_down_factor``
591         Frequency decrease deferral factor, be    592         Frequency decrease deferral factor, between 1 (default) and 10
592         inclusive.                                593         inclusive.
593                                                   594 
594         It effectively causes the frequency to    595         It effectively causes the frequency to go down ``sampling_down_factor``
595         times slower than it ramps up.            596         times slower than it ramps up.
596                                                   597 
597                                                   598 
598 Frequency Boost Support                           599 Frequency Boost Support
599 =======================                           600 =======================
600                                                   601 
601 Background                                        602 Background
602 ----------                                        603 ----------
603                                                   604 
604 Some processors support a mechanism to raise t    605 Some processors support a mechanism to raise the operating frequency of some
605 cores in a multicore package temporarily (and     606 cores in a multicore package temporarily (and above the sustainable frequency
606 threshold for the whole package) under certain    607 threshold for the whole package) under certain conditions, for example if the
607 whole chip is not fully utilized and below its    608 whole chip is not fully utilized and below its intended thermal or power budget.
608                                                   609 
609 Different names are used by different vendors     610 Different names are used by different vendors to refer to this functionality.
610 For Intel processors it is referred to as "Tur    611 For Intel processors it is referred to as "Turbo Boost", AMD calls it
611 "Turbo-Core" or (in technical documentation) "    612 "Turbo-Core" or (in technical documentation) "Core Performance Boost" and so on.
612 As a rule, it also is implemented differently     613 As a rule, it also is implemented differently by different vendors.  The simple
613 term "frequency boost" is used here for brevit    614 term "frequency boost" is used here for brevity to refer to all of those
614 implementations.                                  615 implementations.
615                                                   616 
616 The frequency boost mechanism may be either ha    617 The frequency boost mechanism may be either hardware-based or software-based.
617 If it is hardware-based (e.g. on x86), the dec    618 If it is hardware-based (e.g. on x86), the decision to trigger the boosting is
618 made by the hardware (although in general it r    619 made by the hardware (although in general it requires the hardware to be put
619 into a special state in which it can control t    620 into a special state in which it can control the CPU frequency within certain
620 limits).  If it is software-based (e.g. on ARM    621 limits).  If it is software-based (e.g. on ARM), the scaling driver decides
621 whether or not to trigger boosting and when to    622 whether or not to trigger boosting and when to do that.
622                                                   623 
623 The ``boost`` File in ``sysfs``                   624 The ``boost`` File in ``sysfs``
624 -------------------------------                   625 -------------------------------
625                                                   626 
626 This file is located under :file:`/sys/devices    627 This file is located under :file:`/sys/devices/system/cpu/cpufreq/` and controls
627 the "boost" setting for the whole system.  It     628 the "boost" setting for the whole system.  It is not present if the underlying
628 scaling driver does not support the frequency     629 scaling driver does not support the frequency boost mechanism (or supports it,
629 but provides a driver-specific interface for c    630 but provides a driver-specific interface for controlling it, like
630 |intel_pstate|).                                  631 |intel_pstate|).
631                                                   632 
632 If the value in this file is 1, the frequency     633 If the value in this file is 1, the frequency boost mechanism is enabled.  This
633 means that either the hardware can be put into    634 means that either the hardware can be put into states in which it is able to
634 trigger boosting (in the hardware-based case),    635 trigger boosting (in the hardware-based case), or the software is allowed to
635 trigger boosting (in the software-based case).    636 trigger boosting (in the software-based case).  It does not mean that boosting
636 is actually in use at the moment on any CPUs i    637 is actually in use at the moment on any CPUs in the system.  It only means a
637 permission to use the frequency boost mechanis    638 permission to use the frequency boost mechanism (which still may never be used
638 for other reasons).                               639 for other reasons).
639                                                   640 
640 If the value in this file is 0, the frequency     641 If the value in this file is 0, the frequency boost mechanism is disabled and
641 cannot be used at all.                            642 cannot be used at all.
642                                                   643 
643 The only values that can be written to this fi    644 The only values that can be written to this file are 0 and 1.
644                                                   645 
645 Rationale for Boost Control Knob                  646 Rationale for Boost Control Knob
646 --------------------------------                  647 --------------------------------
647                                                   648 
648 The frequency boost mechanism is generally int    649 The frequency boost mechanism is generally intended to help to achieve optimum
649 CPU performance on time scales below software     650 CPU performance on time scales below software resolution (e.g. below the
650 scheduler tick interval) and it is demonstrabl    651 scheduler tick interval) and it is demonstrably suitable for many workloads, but
651 it may lead to problems in certain situations.    652 it may lead to problems in certain situations.
652                                                   653 
653 For this reason, many systems make it possible    654 For this reason, many systems make it possible to disable the frequency boost
654 mechanism in the platform firmware (BIOS) setu    655 mechanism in the platform firmware (BIOS) setup, but that requires the system to
655 be restarted for the setting to be adjusted as    656 be restarted for the setting to be adjusted as desired, which may not be
656 practical at least in some cases.  For example    657 practical at least in some cases.  For example:
657                                                   658 
658   1. Boosting means overclocking the processor    659   1. Boosting means overclocking the processor, although under controlled
659      conditions.  Generally, the processor's e    660      conditions.  Generally, the processor's energy consumption increases
660      as a result of increasing its frequency a    661      as a result of increasing its frequency and voltage, even temporarily.
661      That may not be desirable on systems that    662      That may not be desirable on systems that switch to power sources of
662      limited capacity, such as batteries, so t    663      limited capacity, such as batteries, so the ability to disable the boost
663      mechanism while the system is running may    664      mechanism while the system is running may help there (but that depends on
664      the workload too).                           665      the workload too).
665                                                   666 
666   2. In some situations deterministic behavior    667   2. In some situations deterministic behavior is more important than
667      performance or energy consumption (or bot    668      performance or energy consumption (or both) and the ability to disable
668      boosting while the system is running may     669      boosting while the system is running may be useful then.
669                                                   670 
670   3. To examine the impact of the frequency bo    671   3. To examine the impact of the frequency boost mechanism itself, it is useful
671      to be able to run tests with and without     672      to be able to run tests with and without boosting, preferably without
672      restarting the system in the meantime.       673      restarting the system in the meantime.
673                                                   674 
674   4. Reproducible results are important when r    675   4. Reproducible results are important when running benchmarks.  Since
675      the boosting functionality depends on the    676      the boosting functionality depends on the load of the whole package,
676      single-thread performance may vary becaus    677      single-thread performance may vary because of it which may lead to
677      unreproducible results sometimes.  That c    678      unreproducible results sometimes.  That can be avoided by disabling the
678      frequency boost mechanism before running     679      frequency boost mechanism before running benchmarks sensitive to that
679      issue.                                       680      issue.
680                                                   681 
681 Legacy AMD ``cpb`` Knob                           682 Legacy AMD ``cpb`` Knob
682 -----------------------                           683 -----------------------
683                                                   684 
684 The AMD powernow-k8 scaling driver supports a     685 The AMD powernow-k8 scaling driver supports a ``sysfs`` knob very similar to
685 the global ``boost`` one.  It is used for disa    686 the global ``boost`` one.  It is used for disabling/enabling the "Core
686 Performance Boost" feature of some AMD process    687 Performance Boost" feature of some AMD processors.
687                                                   688 
688 If present, that knob is located in every ``CP    689 If present, that knob is located in every ``CPUFreq`` policy directory in
689 ``sysfs`` (:file:`/sys/devices/system/cpu/cpuf    690 ``sysfs`` (:file:`/sys/devices/system/cpu/cpufreq/policyX/`) and is called
690 ``cpb``, which indicates a more fine grained c    691 ``cpb``, which indicates a more fine grained control interface.  The actual
691 implementation, however, works on the system-w    692 implementation, however, works on the system-wide basis and setting that knob
692 for one policy causes the same value of it to     693 for one policy causes the same value of it to be set for all of the other
693 policies at the same time.                        694 policies at the same time.
694                                                   695 
695 That knob is still supported on AMD processors    696 That knob is still supported on AMD processors that support its underlying
696 hardware feature, but it may be configured out    697 hardware feature, but it may be configured out of the kernel (via the
697 :c:macro:`CONFIG_X86_ACPI_CPUFREQ_CPB` configu    698 :c:macro:`CONFIG_X86_ACPI_CPUFREQ_CPB` configuration option) and the global
698 ``boost`` knob is present regardless.  Thus it    699 ``boost`` knob is present regardless.  Thus it is always possible use the
699 ``boost`` knob instead of the ``cpb`` one whic    700 ``boost`` knob instead of the ``cpb`` one which is highly recommended, as that
700 is more consistent with what all of the other     701 is more consistent with what all of the other systems do (and the ``cpb`` knob
701 may not be supported any more in the future).     702 may not be supported any more in the future).
702                                                   703 
703 The ``cpb`` knob is never present for any proc    704 The ``cpb`` knob is never present for any processors without the underlying
704 hardware feature (e.g. all Intel ones), even i    705 hardware feature (e.g. all Intel ones), even if the
705 :c:macro:`CONFIG_X86_ACPI_CPUFREQ_CPB` configu    706 :c:macro:`CONFIG_X86_ACPI_CPUFREQ_CPB` configuration option is set.
706                                                   707 
707                                                   708 
708 References                                     !! 709 .. _Per-entity load tracking: https://lwn.net/Articles/531853/
709 ==========                                     << 
710                                                << 
711 .. [1] Jonathan Corbet, *Per-entity load track << 
712        https://lwn.net/Articles/531853/        << 
                                                      

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php