lkml.org 
[lkml]   [2007]   [Nov]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[patch 17/28] cpu alloc: neigbour statistics
Signed-off-by: Christoph Lameter <clameter@sgi.com>

---
include/net/neighbour.h | 2 +-
net/core/neighbour.c | 12 +++++++-----
2 files changed, 8 insertions(+), 6 deletions(-)

Index: linux-2.6/net/core/neighbour.c
===================================================================
--- linux-2.6.orig/net/core/neighbour.c 2007-11-04 20:14:21.000000000 -0800
+++ linux-2.6/net/core/neighbour.c 2007-11-04 20:16:08.000000000 -0800
@@ -35,6 +35,7 @@
#include <linux/random.h>
#include <linux/string.h>
#include <linux/log2.h>
+#include <linux/cpu_alloc.h>

#define NEIGH_DEBUG 1

@@ -1348,7 +1349,8 @@ void neigh_table_init_no_netlink(struct
kmem_cache_create(tbl->id, tbl->entry_size, 0,
SLAB_HWCACHE_ALIGN|SLAB_PANIC,
NULL);
- tbl->stats = alloc_percpu(struct neigh_statistics);
+ tbl->stats = CPU_ALLOC(struct neigh_statistics,
+ GFP_KERNEL | __GFP_ZERO);
if (!tbl->stats)
panic("cannot create neighbour cache statistics");

@@ -1435,7 +1437,7 @@ int neigh_table_clear(struct neigh_table
kfree(tbl->phash_buckets);
tbl->phash_buckets = NULL;

- free_percpu(tbl->stats);
+ CPU_FREE(tbl->stats);
tbl->stats = NULL;

kmem_cache_destroy(tbl->kmem_cachep);
@@ -1692,7 +1694,7 @@ static int neightbl_fill_info(struct sk_
for_each_possible_cpu(cpu) {
struct neigh_statistics *st;

- st = per_cpu_ptr(tbl->stats, cpu);
+ st = CPU_PTR(tbl->stats, cpu);
ndst.ndts_allocs += st->allocs;
ndst.ndts_destroys += st->destroys;
ndst.ndts_hash_grows += st->hash_grows;
@@ -2341,7 +2343,7 @@ static void *neigh_stat_seq_start(struct
if (!cpu_possible(cpu))
continue;
*pos = cpu+1;
- return per_cpu_ptr(tbl->stats, cpu);
+ return CPU_PTR(tbl->stats, cpu);
}
return NULL;
}
@@ -2356,7 +2358,7 @@ static void *neigh_stat_seq_next(struct
if (!cpu_possible(cpu))
continue;
*pos = cpu+1;
- return per_cpu_ptr(tbl->stats, cpu);
+ return CPU_PTR(tbl->stats, cpu);
}
return NULL;
}
Index: linux-2.6/include/net/neighbour.h
===================================================================
--- linux-2.6.orig/include/net/neighbour.h 2007-11-04 20:15:41.000000000 -0800
+++ linux-2.6/include/net/neighbour.h 2007-11-04 20:16:24.000000000 -0800
@@ -83,7 +83,7 @@ struct neigh_statistics
#define NEIGH_CACHE_STAT_INC(tbl, field) \
do { \
preempt_disable(); \
- (per_cpu_ptr((tbl)->stats, smp_processor_id())->field)++; \
+ (THIS_CPU((tbl)->stats)->field)++; \
preempt_enable(); \
} while (0)

--
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2007-11-06 20:59    [W:0.751 / U:0.312 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site