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 22/41] cpu alloc: Convert network sockets inuse counter
Convert handling of the inuse counters to cpu alloc.

Signed-off-by: Christoph Lameter <clameter@sgi.com>
---
net/core/sock.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)

Index: linux-2.6/net/core/sock.c
===================================================================
--- linux-2.6.orig/net/core/sock.c 2008-05-14 19:40:34.000000000 -0700
+++ linux-2.6/net/core/sock.c 2008-05-21 22:00:56.000000000 -0700
@@ -1943,8 +1943,7 @@
#ifdef CONFIG_NET_NS
void sock_prot_inuse_add(struct net *net, struct proto *prot, int val)
{
- int cpu = smp_processor_id();
- per_cpu_ptr(net->core.inuse, cpu)->val[prot->inuse_idx] += val;
+ __CPU_ADD(net->core.inuse->val[prot->inuse_idx], val);
}
EXPORT_SYMBOL_GPL(sock_prot_inuse_add);

@@ -1954,7 +1953,7 @@
int res = 0;

for_each_possible_cpu(cpu)
- res += per_cpu_ptr(net->core.inuse, cpu)->val[idx];
+ res += CPU_PTR(net->core.inuse, cpu)->val[idx];

return res >= 0 ? res : 0;
}
@@ -1962,13 +1961,13 @@

static int sock_inuse_init_net(struct net *net)
{
- net->core.inuse = alloc_percpu(struct prot_inuse);
+ net->core.inuse = CPU_ALLOC(struct prot_inuse, GFP_KERNEL|__GFP_ZERO);
return net->core.inuse ? 0 : -ENOMEM;
}

static void sock_inuse_exit_net(struct net *net)
{
- free_percpu(net->core.inuse);
+ CPU_FREE(net->core.inuse);
}

static struct pernet_operations net_inuse_ops = {
--


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