Skip to contentSkip to conversation

docs/scheduler: fix EEVDF-related inaccuracies in the scheduler docs

PATCH New Zhan Xusheng 1 participant 1 message Jul 30 Documentation

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 docs/scheduler: fix EEVDF-related inaccuracies in the scheduler docs

From: Zhan Xusheng <[email protected]>

While checking the scheduler documentation against the current code I found a few inaccuracies:

- sched-design-CFS.rst still describes the fair class as always running the smallest-vruntime ("leftmost") task and references the rq->cfs.min_vruntime field. Since commit 147f3efaa241 ("sched/fair:
Implement an EEVDF-like scheduling policy") in Linux 6.6 the fair class implements EEVDF -- pick_eevdf() selects the eligible task (lag >= 0) with the earliest virtual deadline -- and the runqueue's zero-lag reference is now cfs_rq->zero_vruntime (the min_vruntime field is gone). Add a note that sections 2 and 3 describe the original CFS design and no longer match the code, rather than rewriting the historical text.

- sched-eevdf.rst said Linux 6.6 was released in 2024 (it was 2023) and described the per-task slice request as "the new sched_setattr() system call". sched_setattr() has existed since Linux 3.14; the slice is carried in the sched_attr::sched_runtime field. Fix both.

No code changes.

---
 Documentation/scheduler/sched-design-CFS.rst | 10 ++++++++++
 Documentation/scheduler/sched-eevdf.rst      |  7 ++++---
 2 files changed, 14 insertions(+), 3 deletions(-)
Documentation/scheduler/sched-design-CFS.rst +10 -0
index 03998f6c8f9c..55163506407b 100644
@@ -15,6 +15,16 @@ scheduler's SCHED_OTHER interactivity code. Nowadays, CFS is making room
 for EEVDF, for which documentation can be found in
 Documentation/scheduler/sched-eevdf.rst.
 
+.. note::
+
+   Since Linux 6.6 the fair scheduling class implements EEVDF rather than
+   the original CFS algorithm.  The task selection and placement described
+   in sections 2 and 3 below (running the smallest-vruntime / "leftmost"
+   task, and the ``rq->cfs.min_vruntime`` field) describe the original CFS
+   design and no longer match the code: EEVDF picks the *eligible* task
+   with the earliest virtual deadline, and the runqueue's zero-lag
+   reference is now tracked in ``cfs_rq->zero_vruntime``.
+
 80% of CFS's design can be summed up in a single sentence: CFS basically models
 an "ideal, precise multi-tasking CPU" on real hardware.
 
Documentation/scheduler/sched-eevdf.rst +4 -3
index 83efe7c0a30d..e3d62de004c6 100644
@@ -4,7 +4,7 @@ EEVDF Scheduler
 
 The "Earliest Eligible Virtual Deadline First" (EEVDF) was first introduced
 in a scientific publication in 1995 [1]. The Linux kernel began
-transitioning to EEVDF in version 6.6 (as a new option in 2024), moving
+transitioning to EEVDF in version 6.6 (released in 2023), moving
 away from the earlier Completely Fair Scheduler (CFS) in favor of a version
 of EEVDF proposed by Peter Zijlstra in 2023 [2-4]. More information
 regarding CFS can be found in
@@ -28,8 +28,9 @@ by sleeping briefly to reset their negative lag: when a task sleeps, it
 remains on the run queue but marked for "deferred dequeue," allowing its
 lag to decay over VRT. Hence, long-sleeping tasks eventually have their lag
 reset. Finally, tasks can preempt others if their VD is earlier, and tasks
-can request specific time slices using the new sched_setattr() system call,
-which further facilitates the job of latency-sensitive applications.
+can request specific time slices via the ``sched_runtime`` field of the
+sched_setattr() system call, which further facilitates the job of
+latency-sensitive applications.
 
 REFERENCES
 ==========
Signature · 1 line
2.43.0