mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] sched/fair: Fix math notation errors in avg_vruntime comment
@ 2026-01-14  9:00 Zhan Xusheng
  2026-01-14 11:19 ` Peter Zijlstra
  2026-01-15 21:44 ` [tip: sched/core] " tip-bot2 for Zhan Xusheng
  0 siblings, 2 replies; 3+ messages in thread
From: Zhan Xusheng @ 2026-01-14  9:00 UTC (permalink / raw)
  To: Peter Zijlstra; +Cc: Ingo Molnar, linux-sched, linux-kernel, Zhan Xusheng

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>
---
 kernel/sched/fair.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index e71302282671..36c6009a0df4 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -576,7 +576,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):
@@ -611,7 +611,7 @@ static inline s64 entity_key(struct cfs_rq *cfs_rq, struct sched_entity *se)
  *              \Sum w_i := cfs_rq->avg_load
  *
  * 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.
-- 
2.43.0


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] sched/fair: Fix math notation errors in avg_vruntime comment
  2026-01-14  9:00 [PATCH] sched/fair: Fix math notation errors in avg_vruntime comment Zhan Xusheng
@ 2026-01-14 11:19 ` Peter Zijlstra
  2026-01-15 21:44 ` [tip: sched/core] " tip-bot2 for Zhan Xusheng
  1 sibling, 0 replies; 3+ messages in thread
From: Peter Zijlstra @ 2026-01-14 11:19 UTC (permalink / raw)
  To: Zhan Xusheng; +Cc: Ingo Molnar, linux-sched, linux-kernel, Zhan Xusheng

On Wed, Jan 14, 2026 at 05:00:35PM +0800, Zhan Xusheng wrote:
> 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>

Fair enough. Thanks!

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [tip: sched/core] sched/fair: Fix math notation errors in avg_vruntime comment
  2026-01-14  9:00 [PATCH] sched/fair: Fix math notation errors in avg_vruntime comment Zhan Xusheng
  2026-01-14 11:19 ` Peter Zijlstra
@ 2026-01-15 21:44 ` tip-bot2 for Zhan Xusheng
  1 sibling, 0 replies; 3+ messages in thread
From: tip-bot2 for Zhan Xusheng @ 2026-01-15 21:44 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: Zhan Xusheng, Peter Zijlstra (Intel), x86, linux-kernel

The following commit has been merged into the sched/core branch of tip:

Commit-ID:     553255cc857c08d72658b57d01c04f76cde9a83a
Gitweb:        https://git.kernel.org/tip/553255cc857c08d72658b57d01c04f76cde9a83a
Author:        Zhan Xusheng <zhanxusheng1024@gmail.com>
AuthorDate:    Wed, 14 Jan 2026 17:00:35 +08:00
Committer:     Peter Zijlstra <peterz@infradead.org>
CommitterDate: Thu, 15 Jan 2026 22:41:26 +01:00

sched/fair: Fix math notation errors in avg_vruntime comment

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 | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index ebee20f..af120e8 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -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.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-01-15 21:44 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-01-14  9:00 [PATCH] sched/fair: Fix math notation errors in avg_vruntime comment Zhan Xusheng
2026-01-14 11:19 ` Peter Zijlstra
2026-01-15 21:44 ` [tip: sched/core] " tip-bot2 for Zhan Xusheng

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®