[lxc-devel] setns() syscall perf issue

Dilip Daya dilip.daya at hp.com
Tue Jan 24 20:54:06 UTC 2012


Would you consider the the following changes to
switch_task_namespaces() ??

I've tested 3.2.1-stable:

--- a/kernel/nsproxy.c    2011-12-08
17:46:59.000000000 -0500
+++ b/kernel/nsproxy.c        2012-01-24
10:30:06.000000000 -0500
@@ -222,7 +222,7 @@ void switch_task_namespaces(struct task_
                 * cannot release this nsproxy via the call_rcu() since
                 * put_mnt_ns() will want to sleep
                 */
-               synchronize_rcu();
+               synchronize_rcu_expedited();
                free_nsproxy(ns);
        }
 }
---


Perf results for setns():

# uname -a
Linux zzzz 3.2.1-setns-synchronize-rcu-expedited-c #1 SMP Tue Jan 24
09:09:04 EST 2012 x86_64 GNU/Linux


# ip netns list
ns6
ns5
ns4
ns3
ns2
ns1


# for i in {1..100} ; do ./a.out ; done
Performed 100 switches
Microseconds per setns() call, average: 6
Performed 100 switches
...
...
Performed 102 switches
Microseconds per setns() call, average: 6

----------------------------------------------------------------------

With:
# uname -a
Linux zzzz 3.2.1-stable #1 SMP Thu Jan 19 20:14:15 EST 2012 x86_64
GNU/Linux

# ip netns list
ns6
ns5
ns4
ns3
ns2
ns1

The same test app looping 100 times produced ~4454 microseconds per
setns() call.


-DilipD.





More information about the lxc-devel mailing list