lkml.org 
[lkml]   [2001]   [Oct]   [31]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [Patch] Re: Nasty suprise with uptime
Why exactly do we use the jiffie count for calculating uptime?  Why not
just record the startup time and compare when needed?


Gerhard



On Wed, 31 Oct 2001, Andreas Dilger wrote:

> On Oct 31, 2001 19:16 +0100, Tim Schmielau wrote:
> > The idea was that all drivers that use the 32 bit jiffies counter have to
> > be aware of the wraparound anyways, and won't see a difference.
>
> Agreed. I also like the change that you initialize jiffies to a pre-wrap
> value, so the jiffies wrap bugs can more easily be found/fixed.
>
> > The race only happens for 64 bit accesses to jiffies, but hey, without
> > the patch these values come out wrong _every_ time, so I believed a
> > tiny window for a single wrong display of uptime every 497.1 days to be
> > acceptable.
>
> I would say that the race is so rare that it should not be handled, especially
> since it adds extra code in the timer interrupt.
>
> > + /* We need to make sure jiffies_high does not change while
> > + * reading jiffies and jiffies_high */
> > + do {
> > + jiffies_high_tmp = jiffies_high_shadow;
> > + barrier();
> > + jiffies_tmp = jiffies;
> > + barrier();
> > + } while (jiffies_high != jiffies_high_tmp);
>
> Maybe this could be condensed into a macro/inline, so that people don't
> screw it up (and it looks cleaner). Like get_jiffies64() or so, for
> those few places that really care about the full value and can't stand
> a miniscule chance of a race (i.e. uptime output is not a candidate).
>
> Cheers, Andreas
> --
> Andreas Dilger
> http://sourceforge.net/projects/ext2resize/
> http://www-mddsp.enel.ucalgary.ca/People/adilger/
>
> -
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/
>

--
Gerhard Mack

gmack@innerfire.net

<>< As a computer I find your faith in technology amusing.

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

\
 
 \ /
  Last update: 2005-03-22 13:12    [from the cache]
©2003-2011 Jasper Spaans. Advertise on this site