lkml.org 
[lkml]   [2018]   [Feb]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] sched/rt: Make update_curr_rt() more accurate

* Wen Yang <wen.yang99@zte.com.cn> wrote:

> rq->clock_task may be updated between the two calls of
> rq_clock_task() in update_curr_rt(). Calling rq_clock_task() only
> once makes it more accurate and efficient, taking update_curr() as
> reference.
>
> Signed-off-by: Wen Yang <wen.yang99@zte.com.cn>
> Reviewed-by: Jiang Biao <jiang.biao2@zte.com.cn>
> ---
> kernel/sched/rt.c | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/kernel/sched/rt.c b/kernel/sched/rt.c
> index 4056c19..d6d2a65 100644
> --- a/kernel/sched/rt.c
> +++ b/kernel/sched/rt.c
> @@ -950,12 +950,13 @@ static void update_curr_rt(struct rq *rq)
> {
> struct task_struct *curr = rq->curr;
> struct sched_rt_entity *rt_se = &curr->rt;
> + u64 now = rq_clock_task(rq);
> u64 delta_exec;
>
> if (curr->sched_class != &rt_sched_class)
> return;
>
> - delta_exec = rq_clock_task(rq) - curr->se.exec_start;
> + delta_exec = now - curr->se.exec_start;

Small nit: shouldn't we calculate 'now' after the return?

OTOH that 'return' should only be triggered statistically AFAICS, i.e. very
rarely.

Thanks,

Ingo

\
 
 \ /
  Last update: 2018-02-05 11:57    [W:0.074 / U:0.580 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site