diff options
author | Eric Dumazet <dada1@cosmosbay.com> | 2007-11-16 06:32:10 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-01-28 17:54:08 -0500 |
commit | 8dbde28d9711475adfe0e9c88505e38743cdc2a7 (patch) | |
tree | 0f41aade985a5626ece9c2007fde14c1ced2a065 /net/ipv4/ip_input.c | |
parent | 68f8353b480e5f2e136c38a511abdbb88eaa8ce2 (diff) |
[NET]: NET_CLS_ROUTE : convert ip_rt_acct to per_cpu variables
ip_rt_acct needs 4096 bytes per cpu to perform some accounting.
It is actually allocated as a single huge array [4096*NR_CPUS]
(rounded up to a power of two)
Converting it to a per cpu variable is wanted to :
- Save space on machines were num_possible_cpus() < NR_CPUS
- Better NUMA placement (each cpu gets memory on its node)
Signed-off-by: Eric Dumazet <dada1@cosmosbay.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4/ip_input.c')
-rw-r--r-- | net/ipv4/ip_input.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/net/ipv4/ip_input.c b/net/ipv4/ip_input.c index 5b8a7603e606..4068e178d747 100644 --- a/net/ipv4/ip_input.c +++ b/net/ipv4/ip_input.c | |||
@@ -347,7 +347,7 @@ static int ip_rcv_finish(struct sk_buff *skb) | |||
347 | 347 | ||
348 | #ifdef CONFIG_NET_CLS_ROUTE | 348 | #ifdef CONFIG_NET_CLS_ROUTE |
349 | if (unlikely(skb->dst->tclassid)) { | 349 | if (unlikely(skb->dst->tclassid)) { |
350 | struct ip_rt_acct *st = ip_rt_acct + 256*smp_processor_id(); | 350 | struct ip_rt_acct *st = per_cpu_ptr(ip_rt_acct, smp_processor_id()); |
351 | u32 idx = skb->dst->tclassid; | 351 | u32 idx = skb->dst->tclassid; |
352 | st[idx&0xFF].o_packets++; | 352 | st[idx&0xFF].o_packets++; |
353 | st[idx&0xFF].o_bytes+=skb->len; | 353 | st[idx&0xFF].o_bytes+=skb->len; |