Re: something about jiffies wraparound overflow

From: Con Kolivas
Date: Tue Dec 27 2005 - 04:04:47 EST


On Tuesday 27 December 2005 19:54, lk wrote:
> As you mentioned the code for comparison:
> > /* code 2*/
> > unsigned long timeout = jiffies + HZ/2;
>
> the code has no problem with jiffies wrapping around
> as long as the values are compared in a right way.
> For a 32 bit platform the counter wraps around only once every 50 day
> when the value of HZ 1000. so if your code is prepared to face this event
> it will work fine.

In 2.6 we actually roll over 5 minutes after starting (the jiffy counter is
set to about 5 minutes from roll over); that was put in on purpose to pick up
wraparound bugs easily.

Cheers,
Con
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/