netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jiri Pirko <jiri@resnulli.us>
To: zhuyj <zyjzyj2000@gmail.com>
Cc: netdev <netdev@vger.kernel.org>
Subject: Re: Fwd: [PATCH 1/1] team: remove unnecessary lock
Date: Fri, 27 May 2016 16:57:57 +0200	[thread overview]
Message-ID: <20160527145757.GA2151@nanopsycho> (raw)
In-Reply-To: <CAD=hENfU8_qQHV6=Zp1y1xYq-AVB5E6Q7pmfpJxNio=MtnnF+A@mail.gmail.com>

Fri, May 27, 2016 at 04:25:29AM CEST, zyjzyj2000@gmail.com wrote:
>Hi, Jiri
>
>I delved into the source code of team. And I found that the function
>team_add_slave actually works in the protection of rtnl lock. So in my
>humble opinion, it is not necessary to use the mutex lock to protect
>team_port_add again.
>
>And I made tests in ubuntu 16.04 server, without the mutex lock, the
>team_add_slave can also work well.
>The steps:
>
>1.
>nmcli con add type team con-name team0 ifname team0 config
>'{"runner":{"name":"activebackup"}}'
>2.
>nmcli con add type team-slave con-name team0-port1 ifname eno16777736
>master team0
>nmcli con add type team-slave con-name team0-port2 ifname eno33554960
>master team0
>
>The above test can work well without the mutex lock. So I made the
>following patch, please comment on this patch.

Well, team lock could be replaced by rtnl and removed. Removing just
this tiny usage solves nothing. I decided to use team-specific lock to
do not overload rtnl at the beginning.


>
>Thanks a lot.
>Zhu Yanjun
>
>From: Zhu Yanjun<zyjzyj2000@gmail.com>
>
>The function team_add_slave works in the context of the rtnl lock.
>It is not necessary to use the mutex lock since the rtnl lock is
>enough.
>
>Signed-off-by: Zhu Yanjun <zyjzyj2000@gmail.com>
>---
> drivers/net/team/team.c | 2 --
> 1 file changed, 2 deletions(-)
>
>diff --git a/drivers/net/team/team.c b/drivers/net/team/team.c
>index a0f64cb..ad84069 100644
>--- a/drivers/net/team/team.c
>+++ b/drivers/net/team/team.c
>@@ -1936,9 +1936,7 @@ static int team_add_slave(struct net_device *dev,
>struct net_device *port_dev)
>        struct team *team = netdev_priv(dev);
>        int err;
>
>-       mutex_lock(&team->lock);
>        err = team_port_add(team, port_dev);
>-       mutex_unlock(&team->lock);
>        return err;
> }
>
>--
>1.9.1

           reply	other threads:[~2016-05-27 14:58 UTC|newest]

Thread overview: expand[flat|nested]  mbox.gz  Atom feed
 [parent not found: <CAD=hENfU8_qQHV6=Zp1y1xYq-AVB5E6Q7pmfpJxNio=MtnnF+A@mail.gmail.com>]

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=20160527145757.GA2151@nanopsycho \
    --to=jiri@resnulli.us \
    --cc=netdev@vger.kernel.org \
    --cc=zyjzyj2000@gmail.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).