From: Ding Tianhong <dingtianhong@huawei.com>
To: Jay Vosburgh <fubar@us.ibm.com>
Cc: Andy Gospodarek <andy@greyhouse.net>,
"David S. Miller" <davem@davemloft.net>,
Nikolay Aleksandrov <nikolay@redhat.com>,
"Veaceslav Falico" <vfalico@redhat.com>,
Netdev <netdev@vger.kernel.org>
Subject: Re: [PATCH net-next v4 6/11] bonding: rebuild the lock use for bond_activebackup_arp_mon()
Date: Tue, 10 Dec 2013 11:28:16 +0800 [thread overview]
Message-ID: <52A68A50.7010404@huawei.com> (raw)
In-Reply-To: <7308.1386643143@death.nxdomain>
On 2013/12/10 10:39, Jay Vosburgh wrote:
> Ding Tianhong <dingtianhong@huawei.com> wrote:
>
>> The bond_activebackup_arp_mon() use the bond lock for read to
>> protect the slave list, it is no effect, and the RTNL is only
>> called for bond_ab_arp_commit() and peer notify, for the performance
>> better, use RCU to replace with the bond lock, to the bond slave
>> list need to called in RCU, add a new bond_first_slave_rcu()
>> to get the first slave in RCU protection.
>>
>> In bond_ab_arp_probe(), the bond->current_arp_slave may changd
>> if bond release slave, just like:
>>
>> bond_ab_arp_probe() bond_release()
>> cpu 0 cpu 1
>> ...
>> if (bond->current_arp_slave...) ...
>> ... bond->current_arp_slave = NULl
>> bond->current_arp_slave->dev->name ...
>>
>> So the current_arp_slave need to dereference in the section.
>>
>> When bond_ab_arp_inspect() and should_notify_peers is true, the
>> RTNL will called twice, it is a loss of performance, so make the
>> two RTNL together to avoid performance loss.
>
> Just for the record, we cannot acquire RTNL every single pass of
> the monitor (at typically ten per second), but the situation you cite is
> rare, and the performance impact of two round trips on RTNL is minimal.
> That said, if the code is clear, there's no disadvantage with arranging
> for just one round trip on RTNL.
>
yes, it is a very slight improvement and hardly convincing to make two
rounds to one, if you strongly disagree with it, I will abandon the modify.
> In patch 2 of the series you reorganized the RTNL locking around
> the inspect / notify_peers logic in bond_mii_monitor to be generally:
>
> if (inspect) {
> [ acquire RTNL ]
> [ do commit activity, et al ]
>
> if (should_notify_peers)
> call_netdevice_notifiers(NETDEV_NOTIFY_PEERS);
>
> [ release RNTL ]
> } else {
> if (should_notify_peers) {
> [ acquire RTNL ]
> call_netdevice_notifiers(NETDEV_NOTIFY_PEERS);
> [ release RTNL ]
> }
> }
>
> but in this patch, the new logic in bond_activebackup_arp_mon
> is:
>
> if (inspect) {
> [ acquire RTNL ]
> [ do commit activity, et al ]
>
> if (should_notify_peers) {
> call_netdevice_notifiers(NETDEV_NOTIFY_PEERS);
> should_notify_peers = false;
> }
> [ release RNTL ]
> }
>
> [ ... ]
>
> re_arm:
>
> if (should_notify_peers) {
> [ acquire RTNL ]
> call_netdevice_notifiers(NETDEV_NOTIFY_PEERS);
> [ release RTNL ]
> }
>
>
> Is there a reason not to have these both operate the same way?
>
> I found the version in bond_mii_monitor (from patch 2 of the
> series) easier to follow than this version for bond_activebackup_arp_mon
> (because the two calls are closer together, and the "should_notify_peers
> = false" is easy to miss on a first read).
>
yes, it is true, although in fact they have same logic, I think the version
in bond_mii_monitor is easy to read, so if you thought the version in
bond_activebackup_arp_mon is bad, I will just follow the version of bond_mii_monitor.
Regards
Ding
prev parent reply other threads:[~2013-12-10 3:30 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-12-07 7:45 [PATCH net-next v4 6/11] bonding: rebuild the lock use for bond_activebackup_arp_mon() Ding Tianhong
2013-12-10 2:39 ` Jay Vosburgh
2013-12-10 3:28 ` Ding Tianhong [this message]
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=52A68A50.7010404@huawei.com \
--to=dingtianhong@huawei.com \
--cc=andy@greyhouse.net \
--cc=davem@davemloft.net \
--cc=fubar@us.ibm.com \
--cc=netdev@vger.kernel.org \
--cc=nikolay@redhat.com \
--cc=vfalico@redhat.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.