summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbluhm <bluhm@openbsd.org>2016-09-02 13:28:21 +0000
committerbluhm <bluhm@openbsd.org>2016-09-02 13:28:21 +0000
commit6b8b9a1c2922c006e7713298cc1cf5fe355511fb (patch)
treec16bf9314552a9579f0342c6be161f08ef342f59
parentAs done in httpd, (re-)initialize ps_what in all processes. This is (diff)
downloadwireguard-openbsd-6b8b9a1c2922c006e7713298cc1cf5fe355511fb.tar.xz
wireguard-openbsd-6b8b9a1c2922c006e7713298cc1cf5fe355511fb.zip
After allocating a single 64 KB mbuf cluster in sosend(), the sending
socket buffer had no space anymore. The default mbuf space limit was only 32 KB. So no more data from user-land was accepted. As tcp_output() keeps the mbuf cluster for retransmits, it will be freed only after all ACKs have been received. That has killed our TCP send performance totally. To allow cycling through the mbufs periodically, we need space for at least 3 of them. Reported by Andreas Bartelt; testing with mikeb@; OK mikeb@ claudio@
-rw-r--r--sys/kern/uipc_socket2.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/sys/kern/uipc_socket2.c b/sys/kern/uipc_socket2.c
index f86e3546b0c..d0f8abb3d7d 100644
--- a/sys/kern/uipc_socket2.c
+++ b/sys/kern/uipc_socket2.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: uipc_socket2.c,v 1.64 2016/06/28 14:47:00 tedu Exp $ */
+/* $OpenBSD: uipc_socket2.c,v 1.65 2016/09/02 13:28:21 bluhm Exp $ */
/* $NetBSD: uipc_socket2.c,v 1.11 1996/02/04 02:17:55 christos Exp $ */
/*
@@ -397,7 +397,8 @@ sbreserve(struct sockbuf *sb, u_long cc)
if (cc == 0 || cc > sb_max)
return (1);
sb->sb_hiwat = cc;
- sb->sb_mbmax = min(cc * 2, sb_max + (sb_max / MCLBYTES) * MSIZE);
+ sb->sb_mbmax = max(3 * MAXMCLBYTES,
+ min(cc * 2, sb_max + (sb_max / MCLBYTES) * MSIZE));
if (sb->sb_lowat > sb->sb_hiwat)
sb->sb_lowat = sb->sb_hiwat;
return (0);