public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* Re: clocksource.c "margin"
  2011-12-01  0:09 clocksource.c "margin" Yang Honggang(Joseph)
@ 2011-11-30 18:43 ` John Stultz
  0 siblings, 0 replies; 2+ messages in thread
From: John Stultz @ 2011-11-30 18:43 UTC (permalink / raw)
  To: Yang Honggang(Joseph); +Cc: linux-kernel

On Wed, 2011-11-30 at 19:09 -0500, Yang Honggang(Joseph) wrote:
> Hi John Stultz,
> I'm very sorry to trouble you. A problem puzzled me when I reading your 
> code in kernel/time/clocksource.c.
> In the following functions, your said in the comments that >>5 was used 
> to leave a margin of 12.5%.
> I don't know how to get the result. I think is should be >> 3 in order 
> to leave a margin of 12.5%.
> The operation of >> 5 only left 3.125% margin.
> 
> __clocksource_updatefreq_scale
> ...
> sec = (cs->mask - (cs->mask >> 5));
> ...
> clocksource_max_deferment
> ...
>      /*
>       * To ensure that the clocksource does not wrap whilst we are idle,
>       * limit the time the clocksource can be deferred by 12.5%. Please
>       * note a margin of 12.5% is used because this can be computed with
>       * a shift, versus say 10% which would require division.
>       */
>      return max_nsecs - (max_nsecs >> 5);
> ...

Indeed. This looks wrong.

Would you like to send a patch in correcting this issue? If not, let me
know and I'll do so.

thanks
-john



^ permalink raw reply	[flat|nested] 2+ messages in thread

* clocksource.c "margin"
@ 2011-12-01  0:09 Yang Honggang(Joseph)
  2011-11-30 18:43 ` John Stultz
  0 siblings, 1 reply; 2+ messages in thread
From: Yang Honggang(Joseph) @ 2011-12-01  0:09 UTC (permalink / raw)
  To: johnstul; +Cc: linux-kernel

Hi John Stultz,
I'm very sorry to trouble you. A problem puzzled me when I reading your 
code in kernel/time/clocksource.c.
In the following functions, your said in the comments that >>5 was used 
to leave a margin of 12.5%.
I don't know how to get the result. I think is should be >> 3 in order 
to leave a margin of 12.5%.
The operation of >> 5 only left 3.125% margin.

__clocksource_updatefreq_scale
...
sec = (cs->mask - (cs->mask >> 5));
...
clocksource_max_deferment
...
     /*
      * To ensure that the clocksource does not wrap whilst we are idle,
      * limit the time the clocksource can be deferred by 12.5%. Please
      * note a margin of 12.5% is used because this can be computed with
      * a shift, versus say 10% which would require division.
      */
     return max_nsecs - (max_nsecs >> 5);
...

Best regards,
Joseph

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-11-30 18:44 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-12-01  0:09 clocksource.c "margin" Yang Honggang(Joseph)
2011-11-30 18:43 ` John Stultz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox