Message ID | 1426139677-27167-1-git-send-email-maheshb@google.com |
---|---|
State | Changes Requested, archived |
Delegated to: | David Miller |
Headers | show |
On Wed, 2015-03-11 at 22:54 -0700, Mahesh Bandewar wrote: > This patch adds code to reschedule the mii-work (aggressively) > just to handle the notification before resuming the regular > cycle. > > Signed-off-by: Mahesh Bandewar <maheshb@google.com> > --- > drivers/net/bonding/bond_main.c | 24 +++++++++++++++--------- > 1 file changed, 15 insertions(+), 9 deletions(-) > > diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c > index 19eabea2d7d9..54ecb7a22bae 100644 > --- a/drivers/net/bonding/bond_main.c > +++ b/drivers/net/bonding/bond_main.c > @@ -2143,10 +2143,13 @@ static void bond_mii_monitor(struct work_struct *work) > if (!bond_has_slaves(bond)) > goto re_arm; > > - rcu_read_lock(); > - > + if (bond_get_notif_pending(bond, BOND_MII_NOTIF)) { > + should_notify_peers = true; > + goto re_arm; > + } > should_notify_peers = bond_should_notify_peers(bond); > > + rcu_read_lock(); > if (bond_miimon_inspect(bond)) { > rcu_read_unlock(); > > @@ -2164,15 +2167,18 @@ static void bond_mii_monitor(struct work_struct *work) > rcu_read_unlock(); > > re_arm: > - if (bond->params.miimon) > - queue_delayed_work(bond->wq, &bond->mii_work, delay); > - > if (should_notify_peers) { > - if (!rtnl_trylock()) > - return; > - call_netdevice_notifiers(NETDEV_NOTIFY_PEERS, bond->dev); > - rtnl_unlock(); > + if (!rtnl_trylock()) { > + delay = 1; > + bond_set_notif_pending(bond, BOND_MII_NOTIF, 1); > + } else { > + call_netdevice_notifiers(NETDEV_NOTIFY_PEERS, bond->dev); > + rtnl_unlock(); > + bond_set_notif_pending(bond, BOND_MII_NOTIF, 0); You probably should clear notif bit before releasing rtnl (same remark for patches 3 & 4) > + } > } > + if (bond->params.miimon) > + queue_delayed_work(bond->wq, &bond->mii_work, delay); > } > > static bool bond_has_this_ip(struct bonding *bond, __be32 ip) -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On Thu, Mar 12, 2015 at 2:34 AM, Eric Dumazet <eric.dumazet@gmail.com> wrote: > On Wed, 2015-03-11 at 22:54 -0700, Mahesh Bandewar wrote: >> This patch adds code to reschedule the mii-work (aggressively) >> just to handle the notification before resuming the regular >> cycle. >> >> Signed-off-by: Mahesh Bandewar <maheshb@google.com> >> --- >> drivers/net/bonding/bond_main.c | 24 +++++++++++++++--------- >> 1 file changed, 15 insertions(+), 9 deletions(-) >> >> diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c >> index 19eabea2d7d9..54ecb7a22bae 100644 >> --- a/drivers/net/bonding/bond_main.c >> +++ b/drivers/net/bonding/bond_main.c >> @@ -2143,10 +2143,13 @@ static void bond_mii_monitor(struct work_struct *work) >> if (!bond_has_slaves(bond)) >> goto re_arm; >> >> - rcu_read_lock(); >> - >> + if (bond_get_notif_pending(bond, BOND_MII_NOTIF)) { >> + should_notify_peers = true; >> + goto re_arm; >> + } >> should_notify_peers = bond_should_notify_peers(bond); >> >> + rcu_read_lock(); >> if (bond_miimon_inspect(bond)) { >> rcu_read_unlock(); >> >> @@ -2164,15 +2167,18 @@ static void bond_mii_monitor(struct work_struct *work) >> rcu_read_unlock(); >> >> re_arm: >> - if (bond->params.miimon) >> - queue_delayed_work(bond->wq, &bond->mii_work, delay); >> - >> if (should_notify_peers) { >> - if (!rtnl_trylock()) >> - return; >> - call_netdevice_notifiers(NETDEV_NOTIFY_PEERS, bond->dev); >> - rtnl_unlock(); >> + if (!rtnl_trylock()) { >> + delay = 1; >> + bond_set_notif_pending(bond, BOND_MII_NOTIF, 1); >> + } else { >> + call_netdevice_notifiers(NETDEV_NOTIFY_PEERS, bond->dev); >> + rtnl_unlock(); >> + bond_set_notif_pending(bond, BOND_MII_NOTIF, 0); > > You probably should clear notif bit before releasing rtnl > > (same remark for patches 3 & 4) > Since this op is atomic and does not need lock, I used it in the current fashion. I probably won't need to clear it if I use the test_and_clear instead of current test_bit() in get_notif_pending() >> + } >> } >> + if (bond->params.miimon) >> + queue_delayed_work(bond->wq, &bond->mii_work, delay); >> } >> >> static bool bond_has_this_ip(struct bonding *bond, __be32 ip) > > -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c index 19eabea2d7d9..54ecb7a22bae 100644 --- a/drivers/net/bonding/bond_main.c +++ b/drivers/net/bonding/bond_main.c @@ -2143,10 +2143,13 @@ static void bond_mii_monitor(struct work_struct *work) if (!bond_has_slaves(bond)) goto re_arm; - rcu_read_lock(); - + if (bond_get_notif_pending(bond, BOND_MII_NOTIF)) { + should_notify_peers = true; + goto re_arm; + } should_notify_peers = bond_should_notify_peers(bond); + rcu_read_lock(); if (bond_miimon_inspect(bond)) { rcu_read_unlock(); @@ -2164,15 +2167,18 @@ static void bond_mii_monitor(struct work_struct *work) rcu_read_unlock(); re_arm: - if (bond->params.miimon) - queue_delayed_work(bond->wq, &bond->mii_work, delay); - if (should_notify_peers) { - if (!rtnl_trylock()) - return; - call_netdevice_notifiers(NETDEV_NOTIFY_PEERS, bond->dev); - rtnl_unlock(); + if (!rtnl_trylock()) { + delay = 1; + bond_set_notif_pending(bond, BOND_MII_NOTIF, 1); + } else { + call_netdevice_notifiers(NETDEV_NOTIFY_PEERS, bond->dev); + rtnl_unlock(); + bond_set_notif_pending(bond, BOND_MII_NOTIF, 0); + } } + if (bond->params.miimon) + queue_delayed_work(bond->wq, &bond->mii_work, delay); } static bool bond_has_this_ip(struct bonding *bond, __be32 ip)
This patch adds code to reschedule the mii-work (aggressively) just to handle the notification before resuming the regular cycle. Signed-off-by: Mahesh Bandewar <maheshb@google.com> --- drivers/net/bonding/bond_main.c | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-)