netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Re: Fwd: [PATCH 1/1] team: remove unnecessary lock
       [not found] ` <CAD=hENfU8_qQHV6=Zp1y1xYq-AVB5E6Q7pmfpJxNio=MtnnF+A@mail.gmail.com>
@ 2016-05-27 14:57   ` Jiri Pirko
  0 siblings, 0 replies; only message in thread
From: Jiri Pirko @ 2016-05-27 14:57 UTC (permalink / raw)
  To: zhuyj; +Cc: netdev

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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2016-05-27 14:58 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <1464280752-30995-1-git-send-email-shandong_liny@163.com>
     [not found] ` <CAD=hENfU8_qQHV6=Zp1y1xYq-AVB5E6Q7pmfpJxNio=MtnnF+A@mail.gmail.com>
2016-05-27 14:57   ` Fwd: [PATCH 1/1] team: remove unnecessary lock Jiri Pirko

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).