summaryrefslogtreecommitdiffstats
path: root/net/core/dev.c
diff options
context:
space:
mode:
authorEric W. Biederman2009-12-03 03:29:04 +0100
committerDavid S. Miller2009-12-03 21:22:02 +0100
commit04dc7f6be3a7b308f8545bb45772c9fb75f71aca (patch)
tree11cfe976f4adffdbdeeed71f591613089e9d6fe5 /net/core/dev.c
parentnet: Add support for batching network namespace cleanups (diff)
downloadkernel-qcow2-linux-04dc7f6be3a7b308f8545bb45772c9fb75f71aca.tar.gz
kernel-qcow2-linux-04dc7f6be3a7b308f8545bb45772c9fb75f71aca.tar.xz
kernel-qcow2-linux-04dc7f6be3a7b308f8545bb45772c9fb75f71aca.zip
net: Move network device exit batching
Move network device exit batching from a special case in net_namespace.c to using common mechanisms in dev.c Signed-off-by: Eric W. Biederman <ebiederm@xmission.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/core/dev.c')
-rw-r--r--net/core/dev.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/net/core/dev.c b/net/core/dev.c
index e3e18dee0bd3..0913a08a87d6 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -5766,8 +5766,33 @@ static void __net_exit default_device_exit(struct net *net)
rtnl_unlock();
}
+static void __net_exit default_device_exit_batch(struct list_head *net_list)
+{
+ /* At exit all network devices most be removed from a network
+ * namespace. Do this in the reverse order of registeration.
+ * Do this across as many network namespaces as possible to
+ * improve batching efficiency.
+ */
+ struct net_device *dev;
+ struct net *net;
+ LIST_HEAD(dev_kill_list);
+
+ rtnl_lock();
+ list_for_each_entry(net, net_list, exit_list) {
+ for_each_netdev_reverse(net, dev) {
+ if (dev->rtnl_link_ops)
+ dev->rtnl_link_ops->dellink(dev, &dev_kill_list);
+ else
+ unregister_netdevice_queue(dev, &dev_kill_list);
+ }
+ }
+ unregister_netdevice_many(&dev_kill_list);
+ rtnl_unlock();
+}
+
static struct pernet_operations __net_initdata default_device_ops = {
.exit = default_device_exit,
+ .exit_batch = default_device_exit_batch,
};
/*