]> git.ipfire.org Git - thirdparty/iproute2.git/commit
iproute2: build nsid-name cache only for commands that need it
authorAnton Aksola <aakso@iki.fi>
Tue, 20 Sep 2016 06:01:27 +0000 (06:01 +0000)
committerStephen Hemminger <stephen@networkplumber.org>
Mon, 10 Oct 2016 01:56:47 +0000 (18:56 -0700)
commite29a8e0537c419aa0a612db39b0feb45148a8350
treeb724362b519f57627f7a008a1968005814dd9ac3
parentd99272470a0f691d592626d4d33fedf6cb647f92
iproute2: build nsid-name cache only for commands that need it

The calling of netns_map_init() before command parsing introduced
a performance issue with large number of namespaces.

As commands such as add, del and exec do not need to iterate through
/var/run/netns it would be good not no build the cache before executing
these commands.

Example:
unpatched:
time seq 1 1000 | xargs -n 1 ip netns add

real    0m16.832s
user    0m1.350s
sys    0m15.029s

patched:
time seq 1 1000 | xargs -n 1 ip netns add

real    0m3.859s
user    0m0.132s
sys    0m3.205s

Signed-off-by: Anton Aksola <aakso@iki.fi>
Acked-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
ip/ip_common.h
ip/ipmonitor.c
ip/ipnetns.c
testsuite/tests/ip/netns/set_nsid.t [new file with mode: 0755]
testsuite/tests/ip/netns/set_nsid_batch.t [new file with mode: 0755]