diff options
author | Changli Gao <xiaosuo@gmail.com> | 2009-11-05 14:51:31 +0100 |
---|---|---|
committer | Patrick McHardy <kaber@trash.net> | 2009-11-05 14:51:31 +0100 |
commit | 5ae27aa2b16478a84d833ab4065798e752941c5a (patch) | |
tree | b3b50c6401a3b0579097cc21ce9c15a13d881dcf | |
parent | 9481721be10a1bfd1ee9ccf507eecd7f37caa5ec (diff) | |
download | op-kernel-dev-5ae27aa2b16478a84d833ab4065798e752941c5a.zip op-kernel-dev-5ae27aa2b16478a84d833ab4065798e752941c5a.tar.gz |
netfilter: nf_conntrack: avoid additional compare.
Signed-off-by: Changli Gao <xiaosuo@gmail.com>
Signed-off-by: Patrick McHardy <kaber@trash.net>
-rw-r--r-- | net/netfilter/nf_conntrack_core.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/net/netfilter/nf_conntrack_core.c b/net/netfilter/nf_conntrack_core.c index 7c9ec3d..8e572d7 100644 --- a/net/netfilter/nf_conntrack_core.c +++ b/net/netfilter/nf_conntrack_core.c @@ -511,11 +511,17 @@ static noinline int early_drop(struct net *net, unsigned int hash) cnt++; } - if (ct && unlikely(nf_ct_is_dying(ct) || - !atomic_inc_not_zero(&ct->ct_general.use))) - ct = NULL; - if (ct || cnt >= NF_CT_EVICTION_RANGE) + if (ct != NULL) { + if (likely(!nf_ct_is_dying(ct) && + atomic_inc_not_zero(&ct->ct_general.use))) + break; + else + ct = NULL; + } + + if (cnt >= NF_CT_EVICTION_RANGE) break; + hash = (hash + 1) % nf_conntrack_htable_size; } rcu_read_unlock(); |