gre: Optimize multiple unregistration
Speedup module unloading by factorizing synchronize_rcu() calls Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
committed by
David S. Miller
parent
0694c4c016
commit
eef6dd65e3
@@ -1290,16 +1290,19 @@ static const struct net_protocol ipgre_protocol = {
|
|||||||
.netns_ok = 1,
|
.netns_ok = 1,
|
||||||
};
|
};
|
||||||
|
|
||||||
static void ipgre_destroy_tunnels(struct ipgre_net *ign)
|
static void ipgre_destroy_tunnels(struct ipgre_net *ign, struct list_head *head)
|
||||||
{
|
{
|
||||||
int prio;
|
int prio;
|
||||||
|
|
||||||
for (prio = 0; prio < 4; prio++) {
|
for (prio = 0; prio < 4; prio++) {
|
||||||
int h;
|
int h;
|
||||||
for (h = 0; h < HASH_SIZE; h++) {
|
for (h = 0; h < HASH_SIZE; h++) {
|
||||||
struct ip_tunnel *t;
|
struct ip_tunnel *t = ign->tunnels[prio][h];
|
||||||
while ((t = ign->tunnels[prio][h]) != NULL)
|
|
||||||
unregister_netdevice(t->dev);
|
while (t != NULL) {
|
||||||
|
unregister_netdevice_queue(t->dev, head);
|
||||||
|
t = t->next;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1347,10 +1350,12 @@ err_alloc:
|
|||||||
static void ipgre_exit_net(struct net *net)
|
static void ipgre_exit_net(struct net *net)
|
||||||
{
|
{
|
||||||
struct ipgre_net *ign;
|
struct ipgre_net *ign;
|
||||||
|
LIST_HEAD(list);
|
||||||
|
|
||||||
ign = net_generic(net, ipgre_net_id);
|
ign = net_generic(net, ipgre_net_id);
|
||||||
rtnl_lock();
|
rtnl_lock();
|
||||||
ipgre_destroy_tunnels(ign);
|
ipgre_destroy_tunnels(ign, &list);
|
||||||
|
unregister_netdevice_many(&list);
|
||||||
rtnl_unlock();
|
rtnl_unlock();
|
||||||
kfree(ign);
|
kfree(ign);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user