From: Saeed Mahameed <sae...@mellanox.com>
Date: Fri, 12 May 2017 14:56:45 +0300

> From: Gal Pressman <g...@mellanox.com>
> 
> 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 <g...@mellanox.com>
> Suggested-by: Eric Dumazet <eric.duma...@gmail.com>
> Cc: kernel-t...@fb.com
> Signed-off-by: Saeed Mahameed <sae...@mellanox.com>

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.

Reply via email to