.. | .. |
---|
1 | | -.. |struct cpufreq_policy| replace:: :c:type:`struct cpufreq_policy <cpufreq_policy>` |
---|
| 1 | +.. SPDX-License-Identifier: GPL-2.0 |
---|
| 2 | +.. include:: <isonum.txt> |
---|
| 3 | + |
---|
2 | 4 | .. |intel_pstate| replace:: :doc:`intel_pstate <intel_pstate>` |
---|
3 | 5 | |
---|
4 | 6 | ======================= |
---|
5 | 7 | CPU Performance Scaling |
---|
6 | 8 | ======================= |
---|
7 | 9 | |
---|
8 | | -:: |
---|
| 10 | +:Copyright: |copy| 2017 Intel Corporation |
---|
9 | 11 | |
---|
10 | | - Copyright (c) 2017 Intel Corp., Rafael J. Wysocki <rafael.j.wysocki@intel.com> |
---|
| 12 | +:Author: Rafael J. Wysocki <rafael.j.wysocki@intel.com> |
---|
| 13 | + |
---|
11 | 14 | |
---|
12 | 15 | The Concept of CPU Performance Scaling |
---|
13 | 16 | ====================================== |
---|
.. | .. |
---|
88 | 91 | all of those CPUs simultaneously. |
---|
89 | 92 | |
---|
90 | 93 | Sets of CPUs sharing hardware P-state control interfaces are represented by |
---|
91 | | -``CPUFreq`` as |struct cpufreq_policy| objects. For consistency, |
---|
92 | | -|struct cpufreq_policy| is also used when there is only one CPU in the given |
---|
| 94 | +``CPUFreq`` as struct cpufreq_policy objects. For consistency, |
---|
| 95 | +struct cpufreq_policy is also used when there is only one CPU in the given |
---|
93 | 96 | set. |
---|
94 | 97 | |
---|
95 | | -The ``CPUFreq`` core maintains a pointer to a |struct cpufreq_policy| object for |
---|
| 98 | +The ``CPUFreq`` core maintains a pointer to a struct cpufreq_policy object for |
---|
96 | 99 | every CPU in the system, including CPUs that are currently offline. If multiple |
---|
97 | 100 | CPUs share the same hardware P-state control interface, all of the pointers |
---|
98 | | -corresponding to them point to the same |struct cpufreq_policy| object. |
---|
| 101 | +corresponding to them point to the same struct cpufreq_policy object. |
---|
99 | 102 | |
---|
100 | | -``CPUFreq`` uses |struct cpufreq_policy| as its basic data type and the design |
---|
| 103 | +``CPUFreq`` uses struct cpufreq_policy as its basic data type and the design |
---|
101 | 104 | of its user space interface is based on the policy concept. |
---|
102 | 105 | |
---|
103 | 106 | |
---|
.. | .. |
---|
143 | 146 | |
---|
144 | 147 | The next major initialization step for a new policy object is to attach a |
---|
145 | 148 | scaling governor to it (to begin with, that is the default scaling governor |
---|
146 | | -determined by the kernel configuration, but it may be changed later |
---|
147 | | -via ``sysfs``). First, a pointer to the new policy object is passed to the |
---|
148 | | -governor's ``->init()`` callback which is expected to initialize all of the |
---|
| 149 | +determined by the kernel command line or configuration, but it may be changed |
---|
| 150 | +later via ``sysfs``). First, a pointer to the new policy object is passed to |
---|
| 151 | +the governor's ``->init()`` callback which is expected to initialize all of the |
---|
149 | 152 | data structures necessary to handle the given policy and, possibly, to add |
---|
150 | 153 | a governor ``sysfs`` interface to it. Next, the governor is started by |
---|
151 | 154 | invoking its ``->start()`` callback. |
---|
152 | 155 | |
---|
153 | | -That callback it expected to register per-CPU utilization update callbacks for |
---|
| 156 | +That callback is expected to register per-CPU utilization update callbacks for |
---|
154 | 157 | all of the online CPUs belonging to the given policy with the CPU scheduler. |
---|
155 | 158 | The utilization update callbacks will be invoked by the CPU scheduler on |
---|
156 | 159 | important events, like task enqueue and dequeue, on every iteration of the |
---|
.. | .. |
---|
396 | 399 | the allowed maximum (that is, the ``scaling_max_freq`` policy limit). In turn, |
---|
397 | 400 | if it is invoked by the CFS scheduling class, the governor will use the |
---|
398 | 401 | Per-Entity Load Tracking (PELT) metric for the root control group of the |
---|
399 | | -given CPU as the CPU utilization estimate (see the `Per-entity load tracking`_ |
---|
400 | | -LWN.net article for a description of the PELT mechanism). Then, the new |
---|
| 402 | +given CPU as the CPU utilization estimate (see the *Per-entity load tracking* |
---|
| 403 | +LWN.net article [1]_ for a description of the PELT mechanism). Then, the new |
---|
401 | 404 | CPU frequency to apply is computed in accordance with the formula |
---|
402 | 405 | |
---|
403 | 406 | f = 1.25 * ``f_0`` * ``util`` / ``max`` |
---|
.. | .. |
---|
756 | 759 | :c:macro:`CONFIG_X86_ACPI_CPUFREQ_CPB` configuration option is set. |
---|
757 | 760 | |
---|
758 | 761 | |
---|
759 | | -.. _Per-entity load tracking: https://lwn.net/Articles/531853/ |
---|
| 762 | +References |
---|
| 763 | +========== |
---|
| 764 | + |
---|
| 765 | +.. [1] Jonathan Corbet, *Per-entity load tracking*, |
---|
| 766 | + https://lwn.net/Articles/531853/ |
---|