sched/rt: fix the error in rt task wait time calculation
PATCH 1/1 sched/rt: fix the error in rt task wait time calculation
From: vincentzhou <[email protected]>
update_stats_wait_end_rt needs to be called in dequeue_task_rt to update the wait_start variable, otherwise calling update_stats_wait_start_rt again will casue a wrong small value of wait_start because the following codes logic:
if (p && likely(wait_start > prev_wait_start))
wait_start -= prev_wait_start;
After that, update_stats_wait_end_rt is called again, it will calculate wait time by using current rq_clock subtracting wait_start which will cause a very big wait time.
Signed-off-by vincentzhou <[email protected]>
--- kernel/sched/rt.c | 4 ++++ 1 file changed, 4 insertions(+)
kernel/sched/rt.c +4 -0
@@ -1488,6 +1488,10 @@ static bool dequeue_task_rt(struct rq *rq, struct task_struct *p, int flags)struct sched_rt_entity *rt_se = &p->rt;update_curr_rt (rq); + +if (!task_current (rq, p)) +update_stats_wait_end_rt (rt_rq_of_se (rt_se), rt_se); +dequeue_rt_entity (rt_se, flags);dequeue_pushable_task (rq, p);
Signature · 1 line
2.25.1