aboutsummaryrefslogtreecommitdiffstats
path: root/net/dccp
diff options
context:
space:
mode:
authorEric Dumazet <dada1@cosmosbay.com>2006-11-16 05:30:37 -0500
committerDavid S. Miller <davem@sunset.davemloft.net>2006-12-03 00:21:44 -0500
commit72a3effaf633bcae9034b7e176bdbd78d64a71db (patch)
treeb7a331527f1b15335a358f97809134f35587e57a /net/dccp
parent3c62f75aac7348ee262b1295cfcfeb3473f76815 (diff)
[NET]: Size listen hash tables using backlog hint
We currently allocate a fixed size (TCP_SYNQ_HSIZE=512) slots hash table for each LISTEN socket, regardless of various parameters (listen backlog for example) On x86_64, this means order-1 allocations (might fail), even for 'small' sockets, expecting few connections. On the contrary, a huge server wanting a backlog of 50000 is slowed down a bit because of this fixed limit. This patch makes the sizing of listen hash table a dynamic parameter, depending of : - net.core.somaxconn tunable (default is 128) - net.ipv4.tcp_max_syn_backlog tunable (default : 256, 1024 or 128) - backlog value given by user application (2nd parameter of listen()) For large allocations (bigger than PAGE_SIZE), we use vmalloc() instead of kmalloc(). We still limit memory allocation with the two existing tunables (somaxconn & tcp_max_syn_backlog). So for standard setups, this patch actually reduce RAM usage. Signed-off-by: Eric Dumazet <dada1@cosmosbay.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/dccp')
-rw-r--r--net/dccp/ipv4.c2
-rw-r--r--net/dccp/proto.c6
2 files changed, 4 insertions, 4 deletions
diff --git a/net/dccp/ipv4.c b/net/dccp/ipv4.c
index e08e7688a26..0a5d68dbb41 100644
--- a/net/dccp/ipv4.c
+++ b/net/dccp/ipv4.c
@@ -1022,7 +1022,7 @@ static void dccp_v4_reqsk_destructor(struct request_sock *req)
1022 kfree(inet_rsk(req)->opt); 1022 kfree(inet_rsk(req)->opt);
1023} 1023}
1024 1024
1025static struct request_sock_ops dccp_request_sock_ops = { 1025static struct request_sock_ops dccp_request_sock_ops _read_mostly = {
1026 .family = PF_INET, 1026 .family = PF_INET,
1027 .obj_size = sizeof(struct dccp_request_sock), 1027 .obj_size = sizeof(struct dccp_request_sock),
1028 .rtx_syn_ack = dccp_v4_send_response, 1028 .rtx_syn_ack = dccp_v4_send_response,
diff --git a/net/dccp/proto.c b/net/dccp/proto.c
index 72cbdcfc2c6..047d170a363 100644
--- a/net/dccp/proto.c
+++ b/net/dccp/proto.c
@@ -262,12 +262,12 @@ int dccp_destroy_sock(struct sock *sk)
262 262
263EXPORT_SYMBOL_GPL(dccp_destroy_sock); 263EXPORT_SYMBOL_GPL(dccp_destroy_sock);
264 264
265static inline int dccp_listen_start(struct sock *sk) 265static inline int dccp_listen_start(struct sock *sk, int backlog)
266{ 266{
267 struct dccp_sock *dp = dccp_sk(sk); 267 struct dccp_sock *dp = dccp_sk(sk);
268 268
269 dp->dccps_role = DCCP_ROLE_LISTEN; 269 dp->dccps_role = DCCP_ROLE_LISTEN;
270 return inet_csk_listen_start(sk, TCP_SYNQ_HSIZE); 270 return inet_csk_listen_start(sk, backlog);
271} 271}
272 272
273int dccp_disconnect(struct sock *sk, int flags) 273int dccp_disconnect(struct sock *sk, int flags)
@@ -788,7 +788,7 @@ int inet_dccp_listen(struct socket *sock, int backlog)
788 * FIXME: here it probably should be sk->sk_prot->listen_start 788 * FIXME: here it probably should be sk->sk_prot->listen_start
789 * see tcp_listen_start 789 * see tcp_listen_start
790 */ 790 */
791 err = dccp_listen_start(sk); 791 err = dccp_listen_start(sk, backlog);
792 if (err) 792 if (err)
793 goto out; 793 goto out;
794 } 794 }