aboutsummaryrefslogtreecommitdiffstats
path: root/net/sctp/protocol.c
diff options
context:
space:
mode:
authorEric Dumazet <dada1@cosmosbay.com>2008-11-26 00:16:35 -0500
committerDavid S. Miller <davem@davemloft.net>2008-11-26 00:16:35 -0500
commit1748376b6626acf59c24e9592ac67b3fe2a0e026 (patch)
tree65a28205daf1ca92e31389440764fc407365014e /net/sctp/protocol.c
parentc1b56878fb68e9c14070939ea4537ad4db79ffae (diff)
net: Use a percpu_counter for sockets_allocated
Instead of using one atomic_t per protocol, use a percpu_counter for "sockets_allocated", to reduce cache line contention on heavy duty network servers. Note : We revert commit (248969ae31e1b3276fc4399d67ce29a5d81e6fd9 net: af_unix can make unix_nr_socks visbile in /proc), since it is not anymore used after sock_prot_inuse_add() addition Signed-off-by: Eric Dumazet <dada1@cosmosbay.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/sctp/protocol.c')
-rw-r--r--net/sctp/protocol.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/net/sctp/protocol.c b/net/sctp/protocol.c
index a8ca743241ee..d5ea232c9126 100644
--- a/net/sctp/protocol.c
+++ b/net/sctp/protocol.c
@@ -102,6 +102,8 @@ struct sock *sctp_get_ctl_sock(void)
102/* Set up the proc fs entry for the SCTP protocol. */ 102/* Set up the proc fs entry for the SCTP protocol. */
103static __init int sctp_proc_init(void) 103static __init int sctp_proc_init(void)
104{ 104{
105 if (percpu_counter_init(&sctp_sockets_allocated, 0))
106 goto out_nomem;
105#ifdef CONFIG_PROC_FS 107#ifdef CONFIG_PROC_FS
106 if (!proc_net_sctp) { 108 if (!proc_net_sctp) {
107 struct proc_dir_entry *ent; 109 struct proc_dir_entry *ent;
@@ -110,7 +112,7 @@ static __init int sctp_proc_init(void)
110 ent->owner = THIS_MODULE; 112 ent->owner = THIS_MODULE;
111 proc_net_sctp = ent; 113 proc_net_sctp = ent;
112 } else 114 } else
113 goto out_nomem; 115 goto out_free_percpu;
114 } 116 }
115 117
116 if (sctp_snmp_proc_init()) 118 if (sctp_snmp_proc_init())
@@ -135,6 +137,8 @@ out_snmp_proc_init:
135 proc_net_sctp = NULL; 137 proc_net_sctp = NULL;
136 remove_proc_entry("sctp", init_net.proc_net); 138 remove_proc_entry("sctp", init_net.proc_net);
137 } 139 }
140out_free_percpu:
141 percpu_counter_destroy(&sctp_sockets_allocated);
138out_nomem: 142out_nomem:
139 return -ENOMEM; 143 return -ENOMEM;
140#else 144#else