netfilter: nf_conntrack: avoid additional compare.
Signed-off-by: Changli Gao <xiaosuo@gmail.com> Signed-off-by: Patrick McHardy <kaber@trash.net>
This commit is contained in:
parent
9481721be1
commit
5ae27aa2b1
1 changed files with 10 additions and 4 deletions
|
@ -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) &&
|
||||||
ct = NULL;
|
atomic_inc_not_zero(&ct->ct_general.use)))
|
||||||
if (ct || cnt >= NF_CT_EVICTION_RANGE)
|
break;
|
||||||
|
else
|
||||||
|
ct = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
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();
|
||||||
|
|
Loading…
Add table
Reference in a new issue