All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH nf-next-2.6] conntrack: one less atomic op in nf_ct_expect_insert()
@ 2010-11-15 22:57 Eric Dumazet
  2010-11-16  9:19 ` Patrick McHardy
  0 siblings, 1 reply; 2+ messages in thread
From: Eric Dumazet @ 2010-11-15 22:57 UTC (permalink / raw)
  To: Patrick McHardy; +Cc: Netfilter Development Mailinglist

Instead of doing atomic_inc(&exp->use) twice,
call atomic_add(2, &exp->use);

Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
---
 net/netfilter/nf_conntrack_expect.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/net/netfilter/nf_conntrack_expect.c b/net/netfilter/nf_conntrack_expect.c
index bbb2140..774f32b 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);
 }
 



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH nf-next-2.6] conntrack: one less atomic op in nf_ct_expect_insert()
  2010-11-15 22:57 [PATCH nf-next-2.6] conntrack: one less atomic op in nf_ct_expect_insert() Eric Dumazet
@ 2010-11-16  9:19 ` Patrick McHardy
  0 siblings, 0 replies; 2+ messages in thread
From: Patrick McHardy @ 2010-11-16  9:19 UTC (permalink / raw)
  To: Eric Dumazet; +Cc: Netfilter Development Mailinglist

On 15.11.2010 23:57, Eric Dumazet wrote:
> Instead of doing atomic_inc(&exp->use) twice,
> call atomic_add(2, &exp->use);

Applied, thanks Eric.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2010-11-16  9:20 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-11-15 22:57 [PATCH nf-next-2.6] conntrack: one less atomic op in nf_ct_expect_insert() Eric Dumazet
2010-11-16  9:19 ` Patrick McHardy

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.