Skip to content

Instantly share code, notes, and snippets.

@philwo
Created November 7, 2017 23:32
Show Gist options
  • Save philwo/fd179cd854eb5d48d35384e25db5643a to your computer and use it in GitHub Desktop.
Save philwo/fd179cd854eb5d48d35384e25db5643a to your computer and use it in GitHub Desktop.
Experimental patch to speed up network namespace destruction under high concurrency load
diff --git a/net/core/net_namespace.c b/net/core/net_namespace.c
index 1fe58167d39a6fb907be443765693e328a1e6b7e..506e6d32fda4ae5071fec1ea397117d161982cb4
100644
--- a/net/core/net_namespace.c
+++ b/net/core/net_namespace.c
@@ -426,7 +426,9 @@ static void cleanup_net(struct work_struct *work)
* This needs to be before calling the exit() notifiers, so
* the rcu_barrier() below isn't sufficient alone.
*/
+ mutex_unlock(&net_mutex);
synchronize_rcu();
+ mutex_lock(&net_mutex);
/* Run all of the network namespace exit methods */
list_for_each_entry_reverse(ops, &pernet_list, list)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment