From: Eric Dumazet Date: Tue, 16 Nov 2010 09:19:18 +0000 (+0100) Subject: netfilter: nf_conntrack: one less atomic op in nf_ct_expect_insert() X-Git-Tag: MMI-PSA29.97-13-9~20520^2~510^2~27 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=3bfd45f93c8bca7a5dc955235ff083602d95aa43;p=GitHub%2FMotorolaMobilityLLC%2Fkernel-slsi.git netfilter: nf_conntrack: one less atomic op in nf_ct_expect_insert() Instead of doing atomic_inc(&exp->use) twice, call atomic_add(2, &exp->use); Signed-off-by: Eric Dumazet Signed-off-by: Patrick McHardy --- diff --git a/net/netfilter/nf_conntrack_expect.c b/net/netfilter/nf_conntrack_expect.c index bbb21402596d..774f32ba2ac9 100644 --- a/net/netfilter/nf_conntrack_expect.c +++ b/net/netfilter/nf_conntrack_expect.c @@ -323,7 +323,8 @@ static void nf_ct_expect_insert(struct nf_conntrack_expect *exp) const struct nf_conntrack_expect_policy *p; unsigned int h = nf_ct_expect_dst_hash(&exp->tuple); - atomic_inc(&exp->use); + /* two references : one for hash insert, one for the timer */ + atomic_add(2, &exp->use); if (master_help) { hlist_add_head(&exp->lnode, &master_help->expectations); @@ -345,7 +346,6 @@ static void nf_ct_expect_insert(struct nf_conntrack_expect *exp) } add_timer(&exp->timeout); - atomic_inc(&exp->use); NF_CT_STAT_INC(net, expect_create); }