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/