From b233773bb9f2d7b382c829856684f216b2d3fb2a Mon Sep 17 00:00:00 2001 From: "Bjoern A. Zeeb" Date: Thu, 25 Aug 2011 09:20:13 +0000 Subject: [PATCH] Increase the defaults for the maximum socket buffer limit, and the maximum TCP send and receive buffer limits from 256kB to 2MB. For sb_max_adj we need to add the cast as already used in the sysctl handler to not overflow the type doing the maths. Note that this is just the defaults. They will allow more memory to be consumed per socket/connection if needed but not change the default "idle" memory consumption. All values are still tunable by sysctls. Suggested by: gnn Discussed on: arch (Mar and Aug 2011) MFC after: 3 weeks Approved by: re (kib) --- sys/kern/uipc_sockbuf.c | 2 +- sys/netinet/tcp_input.c | 2 +- sys/netinet/tcp_output.c | 2 +- sys/sys/sockbuf.h | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/sys/kern/uipc_sockbuf.c b/sys/kern/uipc_sockbuf.c index 2d86d740996..551afac0013 100644 --- a/sys/kern/uipc_sockbuf.c +++ b/sys/kern/uipc_sockbuf.c @@ -61,7 +61,7 @@ void (*aio_swake)(struct socket *, struct sockbuf *); u_long sb_max = SB_MAX; u_long sb_max_adj = - SB_MAX * MCLBYTES / (MSIZE + MCLBYTES); /* adjusted sb_max */ + (quad_t)SB_MAX * MCLBYTES / (MSIZE + MCLBYTES); /* adjusted sb_max */ static u_long sb_efficiency = 8; /* parameter for sbreserve() */ diff --git a/sys/netinet/tcp_input.c b/sys/netinet/tcp_input.c index 7f06bd48bab..b1a8b335cab 100644 --- a/sys/netinet/tcp_input.c +++ b/sys/netinet/tcp_input.c @@ -195,7 +195,7 @@ SYSCTL_VNET_INT(_net_inet_tcp, OID_AUTO, recvbuf_inc, CTLFLAG_RW, &VNET_NAME(tcp_autorcvbuf_inc), 0, "Incrementor step size of automatic receive buffer"); -VNET_DEFINE(int, tcp_autorcvbuf_max) = 256*1024; +VNET_DEFINE(int, tcp_autorcvbuf_max) = 2*1024*1024; #define V_tcp_autorcvbuf_max VNET(tcp_autorcvbuf_max) SYSCTL_VNET_INT(_net_inet_tcp, OID_AUTO, recvbuf_max, CTLFLAG_RW, &VNET_NAME(tcp_autorcvbuf_max), 0, diff --git a/sys/netinet/tcp_output.c b/sys/netinet/tcp_output.c index 572a491be0d..702eed330f1 100644 --- a/sys/netinet/tcp_output.c +++ b/sys/netinet/tcp_output.c @@ -117,7 +117,7 @@ SYSCTL_VNET_INT(_net_inet_tcp, OID_AUTO, sendbuf_inc, CTLFLAG_RW, &VNET_NAME(tcp_autosndbuf_inc), 0, "Incrementor step size of automatic send buffer"); -VNET_DEFINE(int, tcp_autosndbuf_max) = 256*1024; +VNET_DEFINE(int, tcp_autosndbuf_max) = 2*1024*1024; #define V_tcp_autosndbuf_max VNET(tcp_autosndbuf_max) SYSCTL_VNET_INT(_net_inet_tcp, OID_AUTO, sendbuf_max, CTLFLAG_RW, &VNET_NAME(tcp_autosndbuf_max), 0, diff --git a/sys/sys/sockbuf.h b/sys/sys/sockbuf.h index b8e66999028..bfccd74f6f7 100644 --- a/sys/sys/sockbuf.h +++ b/sys/sys/sockbuf.h @@ -37,7 +37,7 @@ #include #include -#define SB_MAX (256*1024) /* default for max chars in sockbuf */ +#define SB_MAX (2*1024*1024) /* default for max chars in sockbuf */ /* * Constants for sb_flags field of struct sockbuf.