Re: [PATCH] cpuidle: Change ktime_get() with local_clock()

From: Peter Zijlstra
Date: Wed Apr 20 2016 - 08:58:43 EST


On Wed, Apr 20, 2016 at 02:30:11PM +0200, Daniel Lezcano wrote:
> On Wed, Apr 20, 2016 at 02:13:15PM +0200, Peter Zijlstra wrote:
> > On Thu, Apr 14, 2016 at 09:23:54PM +0200, Daniel Lezcano wrote:
> > > @@ -217,7 +217,11 @@ int cpuidle_enter_state(struct cpuidle_device *dev, struct cpuidle_driver *drv,
> > > if (!cpuidle_state_is_coupled(drv, entered_state))
> > > local_irq_enable();
> > >
> > > - diff = ktime_to_us(ktime_sub(time_end, time_start));
> > > + /*
> > > + * local_clock() returns the time in nanosecond, let's shift
> > > + * by 10 (divide by 1024) to have microsecond based time.
> > > + */
> > > + diff = (time_end - time_start) >> 10;
> >
> > Changelog fails to explain the ramifications of this change...
>
> Sorry, I don't get the point of your comment. Do you mean I should elaborate
> the comment above in the changelog?

Yeah, why is /1024 good enough?