Skip to contentSkip to conversation

Rewrite mathematical expressions

PATCH In review Jui-Tse Huang 2 participants 2 messages Mar 9, 2022 Documentation

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Rewrite mathematical expressions

There are lots of mathematical expressions in the documentation
which are written in plain text format, which costs reader more time to recognize the expressions. If those expressions are written in LaTeX format which is supported as an extension of Sphinx, the expressions might become prettier as well as more straight forward to reader.

The mathematical expressions in the documentations under
Documentation/scheduler directory are all modified to take the benifits of LaTeX format. The change remains the context of documentations unchanged, but provides a more clear rendering results to reader.

---
 Documentation/scheduler/sched-bwc.rst      |  51 ++--
 Documentation/scheduler/sched-capacity.rst |  80 +++---
 Documentation/scheduler/sched-deadline.rst | 318 +++++++++++----------
 Documentation/scheduler/sched-energy.rst   |  34 +--
 Documentation/scheduler/sched-rt-group.rst |  18 +-
 5 files changed, 274 insertions(+), 227 deletions(-)
Documentation/scheduler/sched-bwc.rst +26 -25
index f166b182ff95..3866ddce6661 100644
@@ -29,35 +29,36 @@ increased interference against the other system users. All nicely bounded.
 
 Traditional (UP-EDF) bandwidth control is something like:
 
-  (U = \Sum u_i) <= 1
+.. math::
+  (U = \sum_{i} u_i) \leq 1
 
 This guaranteeds both that every deadline is met and that the system is
-stable. After all, if U were > 1, then for every second of walltime,
+stable. After all, if :math:`U > 1`, then for every second of walltime,
 we'd have to run more than a second of program time, and obviously miss
 our deadline, but the next deadline will be further out still, there is
 never time to catch up, unbounded fail.
 
 The burst feature observes that a workload doesn't always executes the full
-quota; this enables one to describe u_i as a statistical distribution.
-
-For example, have u_i = {x,e}_i, where x is the p(95) and x+e p(100)
-(the traditional WCET). This effectively allows u to be smaller,
-increasing the efficiency (we can pack more tasks in the system), but at
-the cost of missing deadlines when all the odds line up. However, it
-does maintain stability, since every overrun must be paired with an
-underrun as long as our x is above the average.
-
-That is, suppose we have 2 tasks, both specify a p(95) value, then we
-have a p(95)*p(95) = 90.25% chance both tasks are within their quota and
-everything is good. At the same time we have a p(5)p(5) = 0.25% chance
-both tasks will exceed their quota at the same time (guaranteed deadline
-fail). Somewhere in between there's a threshold where one exceeds and
-the other doesn't underrun enough to compensate; this depends on the
-specific CDFs.
+quota; this enables one to describe :math:`u_i` as a statistical distribution.
+
+For example, have :math:`u_i = \{x,e\}_i`, where :math:`x` is the :math:`p(95)`
+and :math:`x+e` is :math:`p(100)` (the traditional WCET). This effectively
+allows :math:`u` to be smaller, increasing the efficiency (we can pack more
+tasks in the system), but at the cost of missing deadlines when all the odds
+line up. However, it does maintain stability, since every overrun must be paired
+with an underrun as long as our :math:`x` is above the average.
+
+That is, suppose we have 2 tasks, both specify a :math:`p(95)` value, then we
+have a :math:`p(95) \times p(95) = 90.25\%` chance both tasks are within their
+quota and everything is good. At the same time we have a
+:math:`p(5) \times p(5) = 0.25\%` chance both tasks will exceed their quota at
+the same time (guaranteed deadline fail). Somewhere in between there's a
+threshold where one exceeds and the other doesn't underrun enough to compensate;
+this depends on the specific CDFs.
 
 At the same time, we can say that the worst case deadline miss, will be
-\Sum e_i; that is, there is a bounded tardiness (under the assumption
-that x+e is indeed WCET).
+:math:`\sum_{i} e_i`; that is, there is a bounded tardiness (under the
+assumption that :math:`x+e` is indeed WCET).
 
 The interferenece when using burst is valued by the possibilities for
 missing the deadline and the average WCET. Test results showed that when
@@ -141,13 +142,13 @@ This interface is read-only.
 Hierarchical considerations
 ---------------------------
 The interface enforces that an individual entity's bandwidth is always
-attainable, that is: max(c_i) <= C. However, over-subscription in the
-aggregate case is explicitly allowed to enable work-conserving semantics
-within a hierarchy:
+attainable, that is: :math:`max(c_i) \leq C`. However, over-subscription in the
+aggregate case is explicitly allowed to enable work-conserving semantics within
+a hierarchy:
 
-  e.g. \Sum (c_i) may exceed C
+  e.g. :math:`\sum_{i} c_i` may exceed :math:`C`
 
-[ Where C is the parent's bandwidth, and c_i its children ]
+[ Where :math:`C` is the parent's bandwidth, and :math:`c_i` its children ]
 
 
 There are two ways in which a group may become throttled:
Documentation/scheduler/sched-capacity.rst +48 -32

186 lines not on this page · raw message

Documentation/scheduler/sched-deadline.rst +173 -145

441 lines not on this page · raw message

Documentation/scheduler/sched-energy.rst +17 -17
index 8fbce5e767d9..8bc8bd258aae 100644
@@ -33,17 +33,15 @@ To make it clear from the start:
  - power = energy/time = [joule/second] = [watt]
 
 The goal of EAS is to minimize energy, while still getting the job done. That
-is, we want to maximize::
+is, we want to maximize:
 
-	performance [inst/s]
-	--------------------
-	    power [W]
+.. math::
+   \frac{\text{performance (inst/s)}}{\text{power (W)}}
 
-which is equivalent to minimizing::
+which is equivalent to minimizing:
 
-	energy [J]
-	-----------
-	instruction
+.. math::
+   \frac{\text{energy (J)}}{\text{instruction}}
 
 while still getting 'good' performance. It is essentially an alternative
 optimization objective to the current performance-only objective for the
@@ -152,8 +150,8 @@ Example 2.
     composed of two CPUs each. CPU0 and CPU1 are little CPUs; CPU2 and CPU3
     are big.
 
-    The scheduler must decide where to place a task P whose util_avg = 200
-    and prev_cpu = 0.
+    The scheduler must decide where to place a task :math:`P` whose
+    util_avg = 200 and prev_cpu = 0.
 
     The current utilization landscape of the CPUs is depicted on the graph
     below. CPUs 0-3 have a util_avg of 400, 100, 600 and 500 respectively
@@ -183,10 +181,10 @@ Example 2.
 
     find_energy_efficient_cpu() will first look for the CPUs with the
     maximum spare capacity in the two performance domains. In this example,
-    CPU1 and CPU3. Then it will estimate the energy of the system if P was
-    placed on either of them, and check if that would save some energy
-    compared to leaving P on CPU0. EAS assumes that OPPs follow utilization
-    (which is coherent with the behaviour of the schedutil CPUFreq
+    CPU1 and CPU3. Then it will estimate the energy of the system if :math:`P`
+    was placed on either of them, and check if that would save some energy
+    compared to leaving :math:`P` on CPU0. EAS assumes that OPPs follow
+    utilization (which is coherent with the behaviour of the schedutil CPUFreq
     governor, see Section 6. for more details on this topic).
 
     **Case 1. P is migrated to CPU1**::
@@ -364,10 +362,12 @@ too complex (too many CPUs, too many performance domains, too many performance
 states, ...), the cost of using it in the wake-up path can become prohibitive.
 The energy-aware wake-up algorithm has a complexity of:
 
-	C = Nd * (Nc + Ns)
+.. math::
+   C = N_d \cdot (N_c + N_s)
 
-with: Nd the number of performance domains; Nc the number of CPUs; and Ns the
-total number of OPPs (ex: for two perf. domains with 4 OPPs each, Ns = 8).
+with: :math:`N_d` the number of performance domains; :math:`N_c` the number of
+CPUs; and :math:`N_s` the total number of OPPs (ex: for two perf. domains with 4
+OPPs each, :math:`N_s` = 8).
 
 A complexity check is performed at the root domain level, when scheduling
 domains are built. EAS will not start on a root domain if its C happens to be
Documentation/scheduler/sched-rt-group.rst +10 -8
index 655a096ec8fb..9fbb2e7a69c9 100644
@@ -60,14 +60,14 @@ SCHED_OTHER.
 Let's consider an example: a frame fixed realtime renderer must deliver 25
 frames a second, which yields a period of 0.04s per frame. Now say it will also
 have to play some music and respond to input, leaving it with around 80% CPU
-time dedicated for the graphics. We can then give this group a run time of 0.8
-* 0.04s = 0.032s.
+time dedicated for the graphics. We can then give this group a run time of
+:math:`0.8 \times 0.04s = 0.032s`.
 
 This way the graphics group will have a 0.04s period with a 0.032s run time
 limit. Now if the audio thread needs to refill the DMA buffer every 0.005s, but
-needs only about 3% CPU time to do so, it can do with a 0.03 * 0.005s =
-0.00015s. So this group can be scheduled with a period of 0.005s and a run time
-of 0.00015s.
+needs only about 3% CPU time to do so, it can do with a
+:math:`0.03 \times 0.005s = 0.00015s`. So this group can be scheduled with a
+period of 0.005s and a run time of 0.00015s.
 
 The remaining CPU time will be used for user input and other tasks. Because
 realtime tasks have explicitly allocated the CPU time they need to perform
@@ -138,12 +138,14 @@ Documentation/admin-guide/cgroup-v1/cgroups.rst as well.
 Group settings are checked against the following limits in order to keep the
 configuration schedulable:
 
-   \Sum_{i} runtime_{i} / global_period <= global_runtime / global_period
+.. math::
+  \frac{\sum_{i} \text{runtime$_{i}$}}{\text{global\_period}} \leq
+  \frac{\text{global\_runtime}}{\text{global\_period}}
 
 For now, this can be simplified to just the following (but see Future plans):
 
-   \Sum_{i} runtime_{i} <= global_runtime
-
+.. math::
+  \sum_{i} \text{runtime$_{i}$} \leq \text{global\_runtime}
 
 3. Future plans
 ===============
Signature · 1 line
2.25.1
maintainer
#1 lore raw
Quoted 5 lines · Jui-Tse Huang

There are lots of mathematical expressions in the documentation
which are written in plain text format, which costs reader more time to recognize the expressions. If those expressions are written in LaTeX format which is supported as an extension of Sphinx, the expressions might become prettier as well as more straight forward to reader.

I'm sorry, but I'm not going to be able to apply this. We have to think about the readability of the plain-text documentation *first*, and LeTeX source scores poorly on that metric.

So, just for example:

Documentation/scheduler/sched-capacity.rst can. · line 37

Quoted 3 lines
Documentation/scheduler/sched-capacity.rst +2 -1
-  capacity(cpu) = work_per_hz(cpu) * max_freq(cpu)
+.. math::
+  \text{capacity(cpu)} = \text{work\_per\_hz(cpu)} \times \text{max\_freq(cpu)}

The document is not improved by this kind of change, even if the rendered version is prettier.

I do appreciate your effort to make the documentation better, but please focus on the readability of the original docs and not just the rendered version.

Thanks,

jon