[patch 22/41] cpu alloc: Convert network sockets inuse counter

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Convert handling of the inuse counters to cpu alloc.

Signed-off-by: Christoph Lameter <clameter@xxxxxxx>
---
 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 = {

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

[Index of Archives]     [Linux Kernel]     [Kernel Newbies]     [x86 Platform Driver]     [Netdev]     [Linux Wireless]     [Netfilter]     [Bugtraq]     [Linux Filesystems]     [Yosemite Discussion]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Device Mapper]

  Powered by Linux