netfilter: nf_conntrack: use this_cpu_inc()
authorEric Dumazet <edumazet@google.com>
Wed, 18 Apr 2012 04:36:40 +0000 (06:36 +0200)
committerPablo Neira Ayuso <pablo@netfilter.org>
Tue, 8 May 2012 17:36:33 +0000 (19:36 +0200)
this_cpu_inc() is IRQ safe and faster than
local_bh_disable()/__this_cpu_inc()/local_bh_enable(), at least on x86.

Signed-off-by: Eric Dumazet <edumazet@google.com>
Cc: Patrick McHardy <kaber@trash.net>
Cc: Christoph Lameter <cl@linux.com>
Cc: Tejun Heo <tj@kernel.org>
Reviewed-by: Christoph Lameter <cl@linux.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
include/net/netfilter/nf_conntrack.h

index ab86036bbf0c2807240afde3cf970329107358b8..cce7f6a798bf4291a55089450c7b9df52880eb26 100644 (file)
@@ -321,14 +321,8 @@ extern unsigned int nf_conntrack_max;
 extern unsigned int nf_conntrack_hash_rnd;
 void init_nf_conntrack_hash_rnd(void);
 
-#define NF_CT_STAT_INC(net, count)     \
-       __this_cpu_inc((net)->ct.stat->count)
-#define NF_CT_STAT_INC_ATOMIC(net, count)              \
-do {                                                   \
-       local_bh_disable();                             \
-       __this_cpu_inc((net)->ct.stat->count);          \
-       local_bh_enable();                              \
-} while (0)
+#define NF_CT_STAT_INC(net, count)       __this_cpu_inc((net)->ct.stat->count)
+#define NF_CT_STAT_INC_ATOMIC(net, count) this_cpu_inc((net)->ct.stat->count)
 
 #define MODULE_ALIAS_NFCT_HELPER(helper) \
         MODULE_ALIAS("nfct-helper-" helper)