netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Stephen Hemminger <stephen@networkplumber.org>
To: Saeed Mahameed <saeedm@mellanox.com>
Cc: "David S. Miller" <davem@davemloft.net>,
	netdev@vger.kernel.org, Gal Pressman <galp@mellanox.com>,
	kernel-team@fb.com
Subject: Re: [net 1/6] net/mlx5e: Use a spinlock to synchronize statistics
Date: Mon, 15 May 2017 15:51:19 -0700	[thread overview]
Message-ID: <20170515155119.040047d1@xeon-e3> (raw)
In-Reply-To: <20170512115650.11635-2-saeedm@mellanox.com>

On Fri, 12 May 2017 14:56:45 +0300
Saeed Mahameed <saeedm@mellanox.com> wrote:

> diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en.h b/drivers/net/ethernet/mellanox/mlx5/core/en.h
> index 0099a3e397bc..c41cf7e82795 100644
> --- a/drivers/net/ethernet/mellanox/mlx5/core/en.h
> +++ b/drivers/net/ethernet/mellanox/mlx5/core/en.h
> @@ -756,6 +756,7 @@ struct mlx5e_priv {
>  	struct mlx5_core_dev      *mdev;
>  	struct net_device         *netdev;
>  	struct mlx5e_stats         stats;
> +	rwlock_t                   stats_lock;

A reader-writer lock is slower than a spin_lock.
The only case where reader/writer lock is preferred is when writer
will hold onto the lock for a significant amount of time.
Also you only need each statistic to be atomic, the network device API
never guarantees transactional update across multiple statistics.

  parent reply	other threads:[~2017-05-15 22:51 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-12 11:56 [pull request][net 0/6] Mellanox, mlx5 fixes 2017-05-12 Saeed Mahameed
2017-05-12 11:56 ` [net 1/6] net/mlx5e: Use a spinlock to synchronize statistics Saeed Mahameed
2017-05-12 16:13   ` David Miller
2017-05-14  8:52     ` Saeed Mahameed
2017-05-15 18:39       ` David Miller
2017-05-15 22:51   ` Stephen Hemminger [this message]
2017-05-12 11:56 ` [net 2/6] net/mlx5e: Use the correct pause values for ethtool advertising Saeed Mahameed
2017-05-12 11:56 ` [net 3/6] net/mlx5e: Fix ethtool pause support and advertise reporting Saeed Mahameed
2017-05-12 11:56 ` [net 4/6] net/mlx5e: Fix setup TC ndo Saeed Mahameed
2017-05-12 11:56 ` [net 5/6] net/mlx5e: IPoIB, Only support regular RQ for now Saeed Mahameed
2017-05-12 11:56 ` [net 6/6] net/mlx5: Use underlay QPN from the root name space Saeed Mahameed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170515155119.040047d1@xeon-e3 \
    --to=stephen@networkplumber.org \
    --cc=davem@davemloft.net \
    --cc=galp@mellanox.com \
    --cc=kernel-team@fb.com \
    --cc=netdev@vger.kernel.org \
    --cc=saeedm@mellanox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).