[patch 15/41] cpu_alloc: Convert ip route statistics

From: Christoph Lameter
Date: Fri May 30 2008 - 00:15:35 EST


Convert IP route stats to cpu alloc.

Signed-off-by: Christoph Lameter <clameter@xxxxxxx>

Index: linux-2.6/net/ipv4/ip_input.c
===================================================================
--- linux-2.6.orig/net/ipv4/ip_input.c 2008-05-21 22:37:24.000000000 -0700
+++ linux-2.6/net/ipv4/ip_input.c 2008-05-21 22:38:39.000000000 -0700
@@ -345,7 +345,7 @@

#ifdef CONFIG_NET_CLS_ROUTE
if (unlikely(skb->dst->tclassid)) {
- struct ip_rt_acct *st = per_cpu_ptr(ip_rt_acct, smp_processor_id());
+ struct ip_rt_acct *st = THIS_CPU(ip_rt_acct);
u32 idx = skb->dst->tclassid;
st[idx&0xFF].o_packets++;
st[idx&0xFF].o_bytes+=skb->len;
Index: linux-2.6/net/ipv4/route.c
===================================================================
--- linux-2.6.orig/net/ipv4/route.c 2008-05-21 22:37:24.000000000 -0700
+++ linux-2.6/net/ipv4/route.c 2008-05-21 22:38:39.000000000 -0700
@@ -534,7 +534,7 @@
unsigned int j;
u32 *src;

- src = ((u32 *) per_cpu_ptr(ip_rt_acct, i)) + offset;
+ src = ((u32 *) CPU_PTR(ip_rt_acct, i)) + offset;
for (j = 0; j < length/4; j++)
dst[j] += src[j];
}
@@ -3035,7 +3035,8 @@
(jiffies ^ (jiffies >> 7))));

#ifdef CONFIG_NET_CLS_ROUTE
- ip_rt_acct = __alloc_percpu(256 * sizeof(struct ip_rt_acct));
+ ip_rt_acct = cpu_alloc(256 * sizeof(struct ip_rt_acct),
+ GFP_KERNEL|__GFP_ZERO, __alignof__(struct ip_rt_acct));
if (!ip_rt_acct)
panic("IP: failed to allocate ip_rt_acct\n");
#endif

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