netfilter: use jump_label for nf_hooks
commita2d7ec58ac09f30ab726f216827f7c7095b2a98f
authorEric Dumazet <eric.dumazet@gmail.com>
Fri, 18 Nov 2011 17:32:46 +0000 (18 17:32 +0000)
committerDavid S. Miller <davem@davemloft.net>
Mon, 21 Nov 2011 21:38:08 +0000 (21 16:38 -0500)
tree1b733090406abc18c42308e84703dcb703e15125
parent9205fd9ccab8ef51ad771c1917eed7b2f2225d45
netfilter: use jump_label for nf_hooks

On configs where CONFIG_JUMP_LABEL=y, we can replace in fast path a
load/compare/conditional jump by a single jump with no dcache reference.

Jump target is modified as soon as nf_hooks[pf][hook] switches from
empty state to non empty states. jump_label state is kept outside of
nf_hooks array so has no cost on cpu caches.

This patch removes the test on CONFIG_NETFILTER_DEBUG : No need to call
nf_hook_slow() at all if nf_hooks[pf][hook] is empty, this didnt give
useful information, but slowed down things a lot.

Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
CC: Patrick McHardy <kaber@trash.net>
CC: Pablo Neira Ayuso <pablo@netfilter.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
include/linux/netfilter.h
net/netfilter/core.c