[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20170512.121354.1583292892374462482.davem@davemloft.net>
Date: Fri, 12 May 2017 12:13:54 -0400 (EDT)
From: David Miller <davem@...emloft.net>
To: saeedm@...lanox.com
Cc: netdev@...r.kernel.org, galp@...lanox.com, kernel-team@...com
Subject: Re: [net 1/6] net/mlx5e: Use a spinlock to synchronize statistics
From: Saeed Mahameed <saeedm@...lanox.com>
Date: Fri, 12 May 2017 14:56:45 +0300
> From: Gal Pressman <galp@...lanox.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 <galp@...lanox.com>
> Suggested-by: Eric Dumazet <eric.dumazet@...il.com>
> Cc: kernel-team@...com
> Signed-off-by: Saeed Mahameed <saeedm@...lanox.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.
Powered by blists - more mailing lists