Skip to content

Commit

Permalink
bridge: Optimize multiple unregistration
Browse files Browse the repository at this point in the history
Speedup module unloading by factorizing synchronize_rcu() calls

Signed-off-by: Eric Dumazet <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
Eric Dumazet authored and davem330 committed Oct 29, 2009
1 parent 59fd5d8 commit 8c56ba0
Showing 1 changed file with 9 additions and 10 deletions.
19 changes: 9 additions & 10 deletions net/bridge/br_if.c
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ static void del_nbp(struct net_bridge_port *p)
}

/* called with RTNL */
static void del_br(struct net_bridge *br)
static void del_br(struct net_bridge *br, struct list_head *head)
{
struct net_bridge_port *p, *n;

Expand All @@ -165,7 +165,7 @@ static void del_br(struct net_bridge *br)
del_timer_sync(&br->gc_timer);

br_sysfs_delbr(br->dev);
unregister_netdevice(br->dev);
unregister_netdevice_queue(br->dev, head);
}

static struct net_device *new_bridge_dev(struct net *net, const char *name)
Expand Down Expand Up @@ -323,7 +323,7 @@ int br_del_bridge(struct net *net, const char *name)
}

else
del_br(netdev_priv(dev));
del_br(netdev_priv(dev), NULL);

rtnl_unlock();
return ret;
Expand Down Expand Up @@ -462,15 +462,14 @@ int br_del_if(struct net_bridge *br, struct net_device *dev)
void br_net_exit(struct net *net)
{
struct net_device *dev;
LIST_HEAD(list);

rtnl_lock();
restart:
for_each_netdev(net, dev) {
if (dev->priv_flags & IFF_EBRIDGE) {
del_br(netdev_priv(dev));
goto restart;
}
}
for_each_netdev(net, dev)
if (dev->priv_flags & IFF_EBRIDGE)
del_br(netdev_priv(dev), &list);

unregister_netdevice_many(&list);
rtnl_unlock();

}

0 comments on commit 8c56ba0

Please sign in to comment.