Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 8fd5aa3b authored by Srivatsa Vaddagiri's avatar Srivatsa Vaddagiri
Browse files

sched: Fix inaccurate accounting for real-time task



It is possible that rq->clock_task was not updated in put_prev_task()
in which case we can potentially overcharge a real-time task for time
it did not run. This is because clock_task could be stale and not
represent the exact time real-time task started running.

Fix this by forcing update of rq->clock_task when real-time task
starts running.

Change-Id: I8320bb4e47924368583127b950d987925e8e6a6c
Signed-off-by: default avatarSrivatsa Vaddagiri <vatsa@codeaurora.org>
parent 21357f54
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -1423,6 +1423,15 @@ static struct task_struct *_pick_next_task_rt(struct rq *rq)
		rt_rq = group_rt_rq(rt_se);
	} while (rt_rq);

	/*
	 * Force update of rq->clock_task in case we failed to do so in
	 * put_prev_task. A stale value can cause us to over-charge execution
	 * time to real-time task, that could trigger throttling unnecessarily
	 */
	if (rq->skip_clock_update > 0) {
		rq->skip_clock_update = 0;
		update_rq_clock(rq);
	}
	p = rt_task_of(rt_se);
	p->se.exec_start = rq->clock_task;