netns performance

From: Don Bowman
Date: Tue Jun 13 2017 - 22:50:05 EST


This was talked about before (e.g. https://lkml.org/lkml/2014/6/11/42)

In 3.10, this 'script' takes ~1s to run, regardless of # CPU:

ip netns add foo
ip netns add bar
for i in `seq 0 1000`
do
echo -e 'netns exec foo echo\nnetns exec bar echo' >> ipnetns.batch
done
time ip -b ipnetns.batch > /dev/null

On 3.16... 4.12rc5, it gets very slow as you add CPU.

1cpu: 0m1.3
12cpu: 1m36
32cpu: 2m36
72cpu: 3m50

if you have a 2nd copy of it running (e.g .contention) it gets much much worse.

this is in turn causing me an issue in OpenStack Neutron l3-agent,
which creates/destroys/enters namespaces for DHCP, Router.

I had a few shots in the dark of tuning e.g. rcu_nocbs= [tried 0, 1-31, etc].

The commit that was talked about as fixing,
728dba3a39c66b3d8ac889ddbe38b5b1c264aec3, doesn't seem to have
helped me.

I have tried this on Centos7 and Ubuntu 16.10+ kernel configs.
Some work was done characterising this linked
https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1328088

Does anyone have a suggestion?