Re: [PATCH 1/3] timer: Optimize fastpath_timer_check()

From: Jason Low
Date: Wed Aug 26 2015 - 13:31:09 EST


On Wed, 2015-08-26 at 12:57 -0400, George Spelvin wrote:
> > if (!task_cputime_zero(&tsk->cputime_expires)) {
> >+ struct task_cputime task_sample;
> >+ cputime_t utime, stime;
> >+
> >+ task_cputime(tsk, &utime, &stime);
> >+ task_sample.utime = utime;
> >+ task_sample.stime = stime;
> >+ task_sample.sum_exec_runtime = tsk->se.sum_exec_runtime;
>
> Er, task_sample.[us]time are already the correct types.
> Whay are the local variables necessary? How about:
>
> if (!task_cputime_zero(&tsk->cputime_expires)) {
> + struct task_cputime task_sample;
> +
> + task_cputime(tsk, &task_simple.utime, &task_simple.stime);
> + task_sample.sum_exec_runtime = tsk->se.sum_exec_runtime;

Yes, good point. Now that we're moving the task_cputime() call to after
the task_sample structure is declared, the utime and stime local
variables are not required anymore.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/