]> git.proxmox.com Git - mirror_ubuntu-artful-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)
commit933bd83ed60e80ebb1aeb64a2f7cd3190d2312e2
tree8432135759dbea3d42610e7014ff45fcb35eaff1
parent9a08ecfe74d7796ddc92ec312d3b7eaeba5a7c22
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