Skip to contentSkip to conversation

make netns cleanup to run in a separate workq

PATCH In review Daniel Lezcano 2 participants 3 messages Nov 19, 2007 2 messages not in the archive Networking

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 make netns cleanup to run in a separate workq

Subject: make netns cleanup to run in a separate queue
From: Benjamin Thery

---
 net/core/net_namespace.c |    9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
net/core/net_namespace.c +8 -1
Index: linux-2.6-netns/net/core/net_namespace.c
===================================================================
@@ -14,6 +14,7 @@
 static LIST_HEAD(pernet_list);
 static struct list_head *first_device = &pernet_list;
 static DEFINE_MUTEX(net_mutex);
+static struct workqueue_struct *netns_wq;
 
 LIST_HEAD(net_namespace_list);
 
@@ -149,7 +150,7 @@ void __put_net(struct net *net)
 {
 	/* Cleanup the network namespace in process context */
 	INIT_WORK(&net->work, cleanup_net);
-	schedule_work(&net->work);
+	queue_work(netns_wq, &net->work);
 }
 EXPORT_SYMBOL_GPL(__put_net);
 
@@ -172,6 +173,12 @@ static int __init net_ns_init(void)
 					SMP_CACHE_BYTES,
 					SLAB_PANIC, NULL);
 #endif
+
+	/* Create workqueue for cleanup */
+	netns_wq = create_singlethread_workqueue("netns");
+	if (!netns_wq)
+		panic("Could not create netns cleaner");
+
 	mutex_lock(&net_mutex);
 	err = setup_net(&init_net);
 

_______________________________________________
Containers mailing list Containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org
https://lists.linux-foundation.org/mailman/listinfo/containers

A message that is not in the archive (sent off-list or not yet received): 4741583F.3050302-NmTC/[email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]