Skip to content

Commit

Permalink
netfilter: nf_conntrack: one less atomic op in nf_ct_expect_insert()
Browse files Browse the repository at this point in the history
Instead of doing atomic_inc(&exp->use) twice,
call atomic_add(2, &exp->use);

Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: Patrick McHardy <kaber@trash.net>
  • Loading branch information
Eric Dumazet authored and Patrick McHardy committed Nov 16, 2010
1 parent c5d277d commit 3bfd45f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions net/netfilter/nf_conntrack_expect.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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);
}

Expand Down

0 comments on commit 3bfd45f

Please sign in to comment.