]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
sched/fair: Fix math notation errors in avg_vruntime comment
authorZhan Xusheng <zhanxusheng1024@gmail.com>
Wed, 14 Jan 2026 09:00:35 +0000 (17:00 +0800)
committerPeter Zijlstra <peterz@infradead.org>
Thu, 15 Jan 2026 21:41:26 +0000 (22:41 +0100)
The avg_vruntime comment contains a couple of mathematical notation
issues:

 - The summation over w_i * (V - v_i) is written in an ambiguous form
 - The delta term refers to v instead of v0, which is inconsistent
   with the code and preceding explanation

Fix these to make the comment mathematically correct and consistent
with the implementation.

Signed-off-by: Zhan Xusheng <zhanxusheng@xiaomi.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://patch.msgid.link/20260114090035.19033-1-zhanxusheng@xiaomi.com
kernel/sched/fair.c

index ebee20f75fa02f901fd508188f85ca0f8fbd1cef..af120e88720f7e31e9d04afd13e64e5e1b6ba9ac 100644 (file)
@@ -613,7 +613,7 @@ static inline s64 entity_key(struct cfs_rq *cfs_rq, struct sched_entity *se)
  *
  *   \Sum lag_i = 0
  *   \Sum w_i * (V - v_i) = 0
- *   \Sum w_i * V - w_i * v_i = 0
+ *   \Sum (w_i * V - w_i * v_i) = 0
  *
  * From which we can solve an expression for V in v_i (which we have in
  * se->vruntime):
@@ -648,7 +648,7 @@ static inline s64 entity_key(struct cfs_rq *cfs_rq, struct sched_entity *se)
  *              \Sum w_i := cfs_rq->sum_weight
  *
  * Since zero_vruntime closely tracks the per-task service, these
- * deltas: (v_i - v), will be in the order of the maximal (virtual) lag
+ * deltas: (v_i - v0), will be in the order of the maximal (virtual) lag
  * induced in the system due to quantisation.
  *
  * Also, we use scale_load_down() to reduce the size.