[lkml]   [2008]   [Nov]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: [PATCH 1/2] Add round_jiffies_up and related routines
On Wed, 5 Nov 2008, Tejun Heo wrote:

> Alan Stern wrote:
> > This patch (as1158) adds round_jiffies_up() and friends. These
> > routines work like the analogous round_jiffies() functions, except
> > that they will never round down.
> >
> > The new routines will be useful for timeouts where we don't care
> > exactly when the timer expires, provided it doesn't expire too soon.
> >
> > Signed-off-by: Alan Stern <>
> Heh... I have exactly the same patches but mines were named
> round_up_jiffies().

To an American, "round_up_jiffies" sounds like something a cowboy might
do. :-)

I haven't bothered to look throughout the kernel to see where
round_jiffies_up() could be used. Have you done this?

> > + unsigned long j0 = jiffies;
> > +
> > + barrier(); /* Prevent the compiler from aliasing j0 and jiffies */
> > + return round_jiffies_common(j + j0, cpu, false) - j0;
> jiffies is volatile. No need for explicit barrier,

I didn't realize that. Good, it makes things easier.

> but this part is
> necessary for correct operation as if jiffies go up by two the
> calculation will wrap and the returned value will be very large. I
> think this fix deserves a separate patch and proper explanation.

How about if I remove the barrier() call? Should this new code still
go in a separate patch?

Alan Stern

 \ /
  Last update: 2008-11-05 17:23    [W:0.090 / U:0.124 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site