lkml.org 
[lkml]   [2008]   [May]   [30]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[patch 15/41] cpu_alloc: Convert ip route statistics
Convert IP route stats to cpu alloc.

Signed-off-by: Christoph Lameter <clameter@sgi.com>

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
--


\
 
 \ /
  Last update: 2008-05-30 06:17    [W:0.310 / U:0.476 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site