Skip to content

Commit 5d37852

Browse files
jcalvinowensdavem330
authored andcommitted
Revert "net: limit tcp/udp rmem/wmem to SOCK_{RCV,SND}BUF_MIN"
Commit 8133534 ("net: limit tcp/udp rmem/wmem to SOCK_{RCV,SND}BUF_MIN") modified four sysctls to enforce that the values written to them are not less than SOCK_MIN_{RCV,SND}BUF. That change causes 4096 to no longer be accepted as a valid value for 'min' in tcp_wmem and udp_wmem_min. 4096 has been the default for both of those sysctls for a long time, and unfortunately seems to be an extremely popular setting. This change breaks a large number of sysctl configurations at Facebook. That commit referred to b1cb59c ("net: sysctl_net_core: check SNDBUF and RCVBUF for min length"), which choose to use the SOCK_MIN constants as the lower limits to avoid nasty bugs. But AFAICS, a limit of SOCK_MIN_SNDBUF isn't necessary to do that: the BUG_ON cited in the commit message seems to have happened because unix_stream_sendmsg() expects a minimum of a full page (ie SK_MEM_QUANTUM) and the math broke, not because it had less than SOCK_MIN_SNDBUF allocated. This particular issue doesn't seem to affect TCP however: using a setting of "1 1 1" for tcp_{r,w}mem works, although it's obviously suboptimal. SK_MEM_QUANTUM would be a nice minimum, but it's 64K on some archs, so there would still be breakage. Since a value of one doesn't seem to cause any problems, we can drop the minimum 8133534 added to fix this. This reverts commit 8133534. Fixes: 8133534 ("net: limit tcp/udp rmem/wmem to SOCK_MIN...") Cc: Eric Dumazet <eric.dumazet@gmail.com> Cc: Sorin Dumitru <sorin@returnze.ro> Signed-off-by: Calvin Owens <calvinowens@fb.com> Acked-by: Eric Dumazet <edumazet@google.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 83fccfc commit 5d37852

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

net/ipv4/sysctl_net_ipv4.c

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,6 @@ static int tcp_syn_retries_min = 1;
4141
static int tcp_syn_retries_max = MAX_TCP_SYNCNT;
4242
static int ip_ping_group_range_min[] = { 0, 0 };
4343
static int ip_ping_group_range_max[] = { GID_T_MAX, GID_T_MAX };
44-
static int min_sndbuf = SOCK_MIN_SNDBUF;
45-
static int min_rcvbuf = SOCK_MIN_RCVBUF;
4644

4745
/* Update system visible IP port range */
4846
static void set_local_port_range(struct net *net, int range[2])
@@ -530,7 +528,7 @@ static struct ctl_table ipv4_table[] = {
530528
.maxlen = sizeof(sysctl_tcp_wmem),
531529
.mode = 0644,
532530
.proc_handler = proc_dointvec_minmax,
533-
.extra1 = &min_sndbuf,
531+
.extra1 = &one,
534532
},
535533
{
536534
.procname = "tcp_notsent_lowat",
@@ -545,7 +543,7 @@ static struct ctl_table ipv4_table[] = {
545543
.maxlen = sizeof(sysctl_tcp_rmem),
546544
.mode = 0644,
547545
.proc_handler = proc_dointvec_minmax,
548-
.extra1 = &min_rcvbuf,
546+
.extra1 = &one,
549547
},
550548
{
551549
.procname = "tcp_app_win",
@@ -758,15 +756,15 @@ static struct ctl_table ipv4_table[] = {
758756
.maxlen = sizeof(sysctl_udp_rmem_min),
759757
.mode = 0644,
760758
.proc_handler = proc_dointvec_minmax,
761-
.extra1 = &min_rcvbuf,
759+
.extra1 = &one
762760
},
763761
{
764762
.procname = "udp_wmem_min",
765763
.data = &sysctl_udp_wmem_min,
766764
.maxlen = sizeof(sysctl_udp_wmem_min),
767765
.mode = 0644,
768766
.proc_handler = proc_dointvec_minmax,
769-
.extra1 = &min_sndbuf,
767+
.extra1 = &one
770768
},
771769
{ }
772770
};

0 commit comments

Comments
 (0)