-----Original Message-----
From: Eric Dumazet [mailto:eric.dumazet@gmail.com]
Sent: Monday, August 22, 2011 5:18 PM
Le lundi 22 août 2011 à 13:43 +0200, Eric Dumazet a écrit :
quoted
This adds a race for lockless SNMP readers (in be_get_stats64())
They can see the 32bit value going backward.
You have to be very careful to read the *acc once, and write it once.
The "write once" is the only requirement.
Something like :
u32 newval = hi(*acc) + val;
if (wrapped)
newval += 65536;
ACCESS_ONCE(*acc) = newval;
Eric,
I'm wondering why you'd need ACCESS_ONCE() here? Wouldn't using the temp variable (newval) as you suggested,
ensure that the reader doesn't see a half-baked value?