[PATCH] kernel/sched/fair: Fix the issue of virtual runtime conversion error
From: Li kunyu
Date: Tue May 26 2026 - 03:17:51 EST
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@xxxxxxx>
---
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