[Subject Prev][Subject Next][Thread Prev][Thread Next][Subject Index][Thread Index]

Re: jiffies

On Sat, Feb 26, 2000 at 04:16:09AM +0530, Binand Raj S. wrote:
> I am just curious about this.
> The jiffies variable, which the kernel uses to keep track of time, is an
> unsigned long, which is 4 bytes in my system. That means, it can count
> upto 497 days (and a few hours more). Does this mean that the maximum
> uptime that we can get out of a linux system is 497 days?

No. There is a Linux box somewhere in Berkeley that's been up for more 
than 3 years.

> Is a reboot mandatory after that?


> Will the system go haywire if the uptime goes beyond this limit?

It may. Specifically if your machine has a driver, that has the
following code:

now = jiffies;
future = now + HZ * 2;

/* Wait for two seconds */
while (jiffies < future) /* do nothing */;

Such code will hang for 497 days, locking up your system.

One common technique is to set jiffies to 0xffffffff - 1 hour, when you
boot your system. A faulty driver will lock up in an hour.

Also note that jiffies overflow is related to your HZ value. On Alpha
HZ = 1000 (as chosen by Linux) and unsigned long = 64 bits.