mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [patch] use sysctl to adjust SOMAXCONN
@ 2002-05-07 16:13 Nickolai Zeldovich
  0 siblings, 0 replies; only message in thread
From: Nickolai Zeldovich @ 2002-05-07 16:13 UTC (permalink / raw)
  To: linux-kernel

This patch allows the effective SOMAXCONN value to be adjusted
by sysctl, as net.core.listen_max.  The user-space value remains
fixed at the current value of 128, so this should not affect the
behavior of applications by default.  A value larger than 128 is
sometimes useful for benchmarking purposes, when lots of new TCP
connections are established at once.

-- kolya

--- linux-2.5.14/net/socket.c.orig	Sun May  5 23:37:59 2002
+++ linux-2.5.14/net/socket.c	Tue May  7 12:09:56 2002
@@ -1055,14 +1055,15 @@
  *	ready for listening.
  */
 
+int sysctl_listen_max = SOMAXCONN;
 asmlinkage long sys_listen(int fd, int backlog)
 {
 	struct socket *sock;
 	int err;
 	
 	if ((sock = sockfd_lookup(fd, &err)) != NULL) {
-		if ((unsigned) backlog > SOMAXCONN)
-			backlog = SOMAXCONN;
+		if ((unsigned) backlog > sysctl_listen_max)
+			backlog = sysctl_listen_max;
 		err=sock->ops->listen(sock, backlog);
 		sockfd_put(sock);
 	}
--- linux-2.5.14/net/core/sysctl_net_core.c.orig	Sun May  5 23:38:00 2002
+++ linux-2.5.14/net/core/sysctl_net_core.c	Tue May  7 12:09:56 2002
@@ -29,6 +29,7 @@
 extern int sysctl_core_destroy_delay;
 extern int sysctl_optmem_max;
 extern int sysctl_hot_list_len;
+extern int sysctl_listen_max;
 
 #ifdef CONFIG_NET_DIVERT
 extern char sysctl_divert_version[];
@@ -88,6 +89,9 @@
 	 (void *)sysctl_divert_version, 32, 0444, NULL,
 	 &proc_dostring},
 #endif /* CONFIG_NET_DIVERT */
+	{NET_CORE_LISTEN_MAX, "listen_max",
+	 &sysctl_listen_max, sizeof(int), 0644, NULL,
+	 &proc_dointvec},
 #endif /* CONFIG_NET */
 	{ 0 }
 };
--- linux-2.5.14/include/linux/sysctl.h.orig	Sun May  5 23:37:52 2002
+++ linux-2.5.14/include/linux/sysctl.h	Tue May  7 12:10:34 2002
@@ -203,7 +203,8 @@
 	NET_CORE_NO_CONG=14,
 	NET_CORE_LO_CONG=15,
 	NET_CORE_MOD_CONG=16,
-	NET_CORE_DEV_WEIGHT=17
+	NET_CORE_DEV_WEIGHT=17,
+	NET_CORE_LISTEN_MAX=18
 };
 
 /* /proc/sys/net/ethernet */

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2002-05-07 16:13 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-05-07 16:13 [patch] use sysctl to adjust SOMAXCONN Nickolai Zeldovich

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®