From: Saeed Mahameed <[email protected]> Date: Fri, 12 May 2017 14:56:45 +0300
> From: Gal Pressman <[email protected]> > > Add a spinlock to prevent races when querying statistics, for example > querying counters in the middle of a non atomic memcpy() operation in > mlx5e_update_stats(). > > This RW lock should be held when accessing priv->stats, to prevent other > reads/writes. > > Fixes: 9218b44dcc05 ("net/mlx5e: Statistics handling refactoring") > Signed-off-by: Gal Pressman <[email protected]> > Suggested-by: Eric Dumazet <[email protected]> > Cc: [email protected] > Signed-off-by: Saeed Mahameed <[email protected]> This is overkill, and that rwlock is going to show up in perf for some workloads. Furthermore, two kzalloc()'s for a single state update operation? That's not reasonable either. Use a seqlock, which is the primitive for handling this kind of situation cheaply, and adds no atomics to the read path. Thank you.
