Re: [PATCH v2] l2tp: use per-cpu variables for u64_stats updates
From: Eric Dumazet <hidden>
Date: 2012-06-27 21:35:51
From: Eric Dumazet <hidden>
Date: 2012-06-27 21:35:51
On Wed, 2012-06-27 at 14:31 -0700, Ben Greear wrote:
For an example, see the VLAN code. rx-errors and tx-dropped are only 32-bit counters. Now, in the real world, we wouldn't expect those counters to increase at high rates, but they are still 32-bit counters masquerading as 64, and they could wrap after a while, so any code that expected a wrap to mean a 64-bit wrap would be wrong. At the time I was last complaining, there were lots more cases of this that I was fighting with, but I don't recall exactly what they were. Once my user-space code got paranoid enough, it was able to at least mostly deal with 32 and 64 wraps.
Good, you now know how to deal correctly with these things. Using 64bit fields for tx_dropped is what I call kernel bloat. If only all drops were correctly accounted... I believe 50% of drivers are buggy in this aspect.