Skip to content

Commit

Permalink
this_cpu: Use this_cpu ops for network statistics
Browse files Browse the repository at this point in the history
Acked-by: Tejun Heo <tj@kernel.org>
Acked-by: David Miller <davem@davemloft.net>
Signed-off-by: Christoph Lameter <cl@linux-foundation.org>
Signed-off-by: Tejun Heo <tj@kernel.org>
  • Loading branch information
Christoph Lameter authored and Tejun Heo committed Oct 3, 2009
1 parent fce2284 commit 4ea7334
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 8 deletions.
7 changes: 1 addition & 6 deletions include/net/neighbour.h
Original file line number Diff line number Diff line change
Expand Up @@ -90,12 +90,7 @@ struct neigh_statistics
unsigned long unres_discards; /* number of unresolved drops */
};

#define NEIGH_CACHE_STAT_INC(tbl, field) \
do { \
preempt_disable(); \
(per_cpu_ptr((tbl)->stats, smp_processor_id())->field)++; \
preempt_enable(); \
} while (0)
#define NEIGH_CACHE_STAT_INC(tbl, field) this_cpu_inc((tbl)->stats->field)

struct neighbour
{
Expand Down
4 changes: 2 additions & 2 deletions include/net/netfilter/nf_conntrack.h
Original file line number Diff line number Diff line change
Expand Up @@ -295,11 +295,11 @@ extern unsigned int nf_conntrack_htable_size;
extern unsigned int nf_conntrack_max;

#define NF_CT_STAT_INC(net, count) \
(per_cpu_ptr((net)->ct.stat, raw_smp_processor_id())->count++)
__this_cpu_inc((net)->ct.stat->count)
#define NF_CT_STAT_INC_ATOMIC(net, count) \
do { \
local_bh_disable(); \
per_cpu_ptr((net)->ct.stat, raw_smp_processor_id())->count++; \
__this_cpu_inc((net)->ct.stat->count); \
local_bh_enable(); \
} while (0)

Expand Down

0 comments on commit 4ea7334

Please sign in to comment.