Subject: Re: [PATCH]snmp6 64-bit counter support in proc.c

From: "David S. Miller" <[email-masked]>
Date: Thu, 22 Jan 2004 14:10:26 -0800

The most portable and simple algorithm to solve this on the reader
side is (and I recommend we don't special case this on 64-bit platforms
just to get wider testing):

	u32 high, low1, low2;

	do {
		low1 = stat & 0xffffffff;
		rmb();
		high = stat >> 32;
		rmb();
		low2 = stat & 0xffffffff;
	} while (low2 < low1);

Something like that.  The idea is to sample the lower 32-bit twice
and if it overflows resample both high and low halfs.