]> git.baikalelectronics.ru Git - kernel.git/commit
netfilter: batch synchronize_net calls during hook unregister
authorFlorian Westphal <fw@strlen.de>
Mon, 24 Apr 2017 13:37:39 +0000 (15:37 +0200)
committerPablo Neira Ayuso <pablo@netfilter.org>
Mon, 1 May 2017 09:18:54 +0000 (11:18 +0200)
commitf15c1a88fb54c14e7647d251263a243807efcdbd
tree8432135759dbea3d42610e7014ff45fcb35eaff1
parent545c8bcebc9ed406ba265ec03d59e664d17a96a7
netfilter: batch synchronize_net calls during hook unregister

synchronize_net is expensive and slows down netns cleanup a lot.

We have two APIs to unregister a hook:
nf_unregister_net_hook (which calls synchronize_net())
and
nf_unregister_net_hooks (calls nf_unregister_net_hook in a loop)

Make nf_unregister_net_hook a wapper around new helper
__nf_unregister_net_hook, which unlinks the hook but does not free it.

Then, we can call that helper in nf_unregister_net_hooks and then
call synchronize_net() only once.

Andrey Konovalov reports this change improves syzkaller fuzzing speed at
least twice.

Signed-off-by: Florian Westphal <fw@strlen.de>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
net/netfilter/core.c