Re: [PATCH 1/4] sched,time: remove non-power-of-two divides from __acct_update_integrals

From: Peter Zijlstra
Date: Mon Feb 01 2016 - 06:30:20 EST


On Sat, Jan 30, 2016 at 12:53:09PM -0500, Rik van Riel wrote:
> >> + delta = cputime_to_nsecs(dtime);
> >
> > You might want to add a comment specifying why we don't call cputime_to_usecs()
> > directly (because we optimize if delta < TICK_NSEC).
> >
> > Although this has a good impact on nohz_full, it might have a tiny bad one on !nohz_full
> > because now we first convert jiffies to nsecs (which implies a multiplication by 1000)
> > that we later divide again by 1000. Now this is ok because I plan to convert tsk->utime/stime
> > to nsecs and thus remove most of the cputime_t use and conversions everywhere.
>
> Isn't cputime_t in nanoseconds even on !nohz_full systems nowadays,
> due to sched_clock?

Don't think so, we still use jiffy accounting for !NOHZ_FULL.

> Also, a multiplication is essentially instantaneous compared to
> a division, which is why Peter suggested going this way around.

Yep.