Commit 5ae27aa2 authored by Changli Gao's avatar Changli Gao Committed by Patrick McHardy

netfilter: nf_conntrack: avoid additional compare.

Signed-off-by: default avatarChangli Gao <xiaosuo@gmail.com>
Signed-off-by: default avatarPatrick McHardy <kaber@trash.net>
parent 9481721b
...@@ -511,11 +511,17 @@ static noinline int early_drop(struct net *net, unsigned int hash) ...@@ -511,11 +511,17 @@ static noinline int early_drop(struct net *net, unsigned int hash)
cnt++; cnt++;
} }
if (ct && unlikely(nf_ct_is_dying(ct) || if (ct != NULL) {
!atomic_inc_not_zero(&ct->ct_general.use))) if (likely(!nf_ct_is_dying(ct) &&
atomic_inc_not_zero(&ct->ct_general.use)))
break;
else
ct = NULL; ct = NULL;
if (ct || cnt >= NF_CT_EVICTION_RANGE) }
if (cnt >= NF_CT_EVICTION_RANGE)
break; break;
hash = (hash + 1) % nf_conntrack_htable_size; hash = (hash + 1) % nf_conntrack_htable_size;
} }
rcu_read_unlock(); rcu_read_unlock();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment