The Linux Kernel Mailing List
 help / color / mirror / Atom feed
* [PATCH] kernel/sched/fair: Fix the issue of virtual runtime conversion error
@ 2026-05-26  7:15 Li kunyu
  2026-05-27  1:16 ` kernel test robot
  2026-05-27  7:21 ` [PATCH v2] " Li kunyu
  0 siblings, 2 replies; 7+ messages in thread
From: Li kunyu @ 2026-05-26  7:15 UTC (permalink / raw)
  To: mingo, peterz, juri.lelli, vincent.guittot, dietmar.eggemann,
	rostedt, bsegall, mgorman, vschneid, kprateek.nayak
  Cc: linux-kernel, Li kunyu

The logic of the function here should be to convert the virtual runtime
into actual time by combining it with the weight of the scheduling
entity.
However, it cannot be converted by simply converting actual time into
virtual running time. A reverse conversion is required to obtain the
correct time.

Signed-off-by: Li kunyu <likunyu10@163.com>
---
 kernel/sched/fair.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index 69361c63353a..456cc6104310 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -7033,7 +7033,9 @@ static void hrtick_start_fair(struct rq *rq, struct task_struct *p)
 			resched_curr(rq);
 		return;
 	}
-	delta = (se->load.weight * vdelta) / NICE_0_LOAD;
+
+	if (unlikely(se->load.weight != NICE_0_LOAD))
+		delta = (NICE_0_LOAD * vdelta) / se->load.weight;
 
 	/*
 	 * Correct for instantaneous load of other classes.
-- 
2.47.3


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

end of thread, other threads:[~2026-05-28  9:59 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-26  7:15 [PATCH] kernel/sched/fair: Fix the issue of virtual runtime conversion error Li kunyu
2026-05-27  1:16 ` kernel test robot
2026-05-27  6:48   ` Geert Uytterhoeven
2026-05-27  7:21 ` [PATCH v2] " Li kunyu
2026-05-27 11:59   ` Peter Zijlstra
2026-05-28  6:07     ` Li kunyu
2026-05-28  9:58   ` kernel test robot

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