Re: Uptime counter

From: Matthew Reppert
Date: Sun Feb 01 2004 - 16:26:35 EST


On Sun, 2004-02-01 at 16:07, Ludootje wrote:
> On Sun, 2004-02-01 at 20:51, Matti Aarnio wrote:
> > On Sun, Feb 01, 2004 at 10:41:41PM +0200, Markus HÃstbacka wrote:
> > > Hi list,
> > > I wonder does any kernel branch have a uptime counter that doesn't stop
> > > counting at 497 days? Or is a patch needed for the job to
> > > 2.{0,2,4,6} kernel?
> >
> > Any 64 bit machine since day 1, but also 2.6 at i386 does work.
> >
> > > Markus
> >
> > /Matti Aarnio
>
> It's the first time I hear about the uptime being resetted after 497 days,
> why is this? Is this a mistake or are their reasons for it?

On 32-bit architectures, the uptime counter is only 32 bits wide. Each
"tick" of the counter is worth 1/HZ seconds (IIRC). So, you can get the
number of seconds this will hold with simple math (2^32 * 1/HZ, HZ
being 100 on i386). This is about 497.1 days.

Of course, on 64-bit architectures, the counter will hold 4 billion
times that, which is about as long as the Earth has existed. Apparently
2.6 has come up with a way to deal with this on 32-bit architectures.

Matt

Attachment: signature.asc
Description: This is a digitally signed message part