Re: Jiffies Wraparound (was Re: interrupt counts)

Linus Torvalds (
Tue, 20 Aug 1996 10:50:08 +0300 (EET DST)

On Tue, 20 Aug 1996, Mike Kilburn wrote:
> On Mon, 19 Aug 1996, mlord wrote:
> > The one that really worries me is having the "jiffies" wrap around,
> > an event which will happen every 17 months or so on production systems.
> >
> > A *lot* of the kernel will malfunction when that happens.
> I would hope not. We always do diff = jiffies - oldtime; GCC handles
> the wrap correctly (look at the asm output) if all are the same unsigned
> type. What else could go wrong?

In _many_ places we do the jiffies handling correctly. Not in every place,
though (or even most places). So jiffies wrapping is potentially a real
problem, although I do have one report that when the jiffies wrapped nothing
bad happened (various minor things, but the machine didn't crash).

(Oh, and it's not gcc handling the wrap correctly: it's the C language. The
C language defines that unsigned arithmetic _has_ to work the way we want it
to work, so you don't even need to look at the asm output).