Re: [Patch] Re: Nasty suprise with uptime

Ville Herva
2001-11-01T07:46:24Z

On Wed, Oct 31, 2001 at 04:17:36PM -0500, you [Richard B. Johnson] claimed:
> > u64 get_jiffies64(void)
> > {
> > static unsigned long jiffies_hi = 0;
> > static unsigned long jiffies_last = INITIAL_JIFFIES;
> >
> > /* probably need locking for this part */
> > if (jiffies < jiffies_last) { /* We have a wrap */
> > jiffies_hi++;
> > jiffies_last = jiffies;
> > }
> >
> > return (jiffies | ((u64)jiffies_hi) << LONG_SHIFT));
> > }
>
> Ah, yes. It's perfect. It could be put right in the 'uptime' code.
> It has zero overhead otherwise.

Just my two cents... I would prefer that to be in kernel (it has what, 8
byte overhead), so that /proc/uptime is correct, not just uptime(1) output.
There are other programs that access /proc/uptime as well, so it would be
good to fix it in one place.

I was thinking, could there be a elegant(ish) place in the kernel where one
could drop a dummy call to get_jiffies64 so that it would always be called
at least once a 497 days (I'm not sure wher the 1.3 years value comes from)?

Other than that this seems a good alternative.

-- v --

v@iki.fi