Re: [PATCH] timers: Fix timer inaccuracy

2016-11-13 Thread skannan
On 2016-11-12 03:25, Thomas Gleixner wrote: On Fri, 11 Nov 2016, Saravana Kannan wrote: On 11/10/2016 02:07 AM, Thomas Gleixner wrote: > Deferrable timers shouldn't have been invented in the first place and yes, > they are not going to happen on hrtimers, quite the contrary, I'm working > on eli

Re: [PATCH] timers: Fix timer inaccuracy

2016-11-12 Thread Thomas Gleixner
On Fri, 11 Nov 2016, Saravana Kannan wrote: > On 11/10/2016 02:07 AM, Thomas Gleixner wrote: > > Deferrable timers shouldn't have been invented in the first place and yes, > > they are not going to happen on hrtimers, quite the contrary, I'm working > > on eliminating them completely. > > If you d

Re: [PATCH] timers: Fix timer inaccuracy

2016-11-11 Thread Saravana Kannan
On 11/10/2016 02:07 AM, Thomas Gleixner wrote: On Wed, 9 Nov 2016, Joonwoo Park wrote: So this timer expired exactly a few micro seconds after arming and therefor violates the guarantee of firing not before the specified interval. So depending on when you arm the timer the expiry is going to

Re: [PATCH] timers: Fix timer inaccuracy

2016-11-10 Thread Thomas Gleixner
On Wed, 9 Nov 2016, Joonwoo Park wrote: > On 11/09/2016 01:56 AM, Thomas Gleixner wrote: > > That's simply wrong. We guarantee that the timer sleeps for at least a > > jiffy. So in case of the first wheel we _must_ increment by one simply > > because the next jiffie might be immanent and not doing

Re: [PATCH] timers: Fix timer inaccuracy

2016-11-09 Thread Joonwoo Park
On 11/09/2016 01:56 AM, Thomas Gleixner wrote: On Wed, 9 Nov 2016, Joonwoo Park wrote: When a new timer list enqueued into the time wheel, array index for the given expiry time is: expires = (expires + LVL_GRAN(lvl)) >> LVL_SHIFT(lvl); idx = LVL_OFFS(lvl) + (expires & LVL_MASK); The gra

Re: [PATCH] timers: Fix timer inaccuracy

2016-11-09 Thread Thomas Gleixner
On Wed, 9 Nov 2016, Joonwoo Park wrote: > When a new timer list enqueued into the time wheel, array index > for the given expiry time is: > > expires = (expires + LVL_GRAN(lvl)) >> LVL_SHIFT(lvl); > idx = LVL_OFFS(lvl) + (expires & LVL_MASK); > > The granularity of the expiry time level is b

[PATCH] timers: Fix timer inaccuracy

2016-11-09 Thread Joonwoo Park
When a new timer list enqueued into the time wheel, array index for the given expiry time is: expires = (expires + LVL_GRAN(lvl)) >> LVL_SHIFT(lvl); idx = LVL_OFFS(lvl) + (expires & LVL_MASK); The granularity of the expiry time level is being added to the index in order to fire the timer afte