From: Nickolai Zeldovich <kolya@MIT.EDU>
To: linux-kernel@vger.kernel.org
Subject: [patch] use sysctl to adjust SOMAXCONN
Date: Tue, 07 May 2002 12:13:45 -0400 [thread overview]
Message-ID: <200205071613.MAA22929@contents-vnder-pressvre.mit.edu> (raw)
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 */
reply other threads:[~2002-05-07 16:13 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200205071613.MAA22929@contents-vnder-pressvre.mit.edu \
--to=kolya@mit.edu \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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®