netfilter: avoid additional compare.
Subsystems (2)
PATCH 1/1 netfilter: avoid additional compare.
avoid additional compare.
avoid additional compare.
----net/netfilter/nf_conntrack_core.c | 14 ++++++++++----
1 file changed, 10 insertions(+), 4 deletions(-)
net/netfilter/nf_conntrack_core.c +10 -4
@@ -512,11 +512,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_EVICITON_RANGE )break ; + hash = (hash +1 ) % nf_conntrack_htable_size; }rcu_read_unlock ();
Quoted 3 lines · Changli Gao
avoid additional compare.
avoid additional compare.
This doesn't even compile:
net/netfilter/nf_conntrack_core.c: In function 'early_drop':net/netfilter/nf_conntrack_core.c:522: error: 'NF_CT_EVICITON_RANGE' undeclared (first use in this function)
Please don't send me untested patches.
Quoted 5 lines · Patrick McHardy
Quoted 3 lines · Changli Gao
avoid additional compare.
avoid additional compare.
Quoted 8 lines
This doesn't even compile:
net/netfilter/nf_conntrack_core.c: In function 'early_drop':net/netfilter/nf_conntrack_core.c:522: error: 'NF_CT_EVICITON_RANGE' undeclared (first use in this function)Please don't send me untested patches.
Oh, I am sorry. I sent the wrong version. :( The macro NF_CT_EVICITON_RANGE should be NF_CT_EVICITION_RANGE.
Signature · 6 lines
Regards, Changli Gao([email protected]) -- To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html