Eliminate the dramatic TCP performance decrease observed for writes in

the range [210:260] by sweeping the problem under the rug.  This change
has the following effects:

1) A new MIB variable in the kern branch is defined to allow modification
of the socket buffer layer's ``wastage factor'' (which determines how
much unused-but-allocated space in mbufs and mbuf clusters is allowed
in a socket buffer).

2) The default value of the wastage factor is changed from 2 to 8.
The original value was chosen when MINCLSIZE was 7*MLEN (!), and is not
appropriate for an environment where MINCLSIZE is much less.

The real solution to this problem is to scrap both mbufs and sockbufs
and completely redesign the buffering mechanism used at both levels.
This commit is contained in:
Garrett Wollman 1996-01-05 21:41:54 +00:00
parent d4fb926c62
commit 4b29bc4f8a
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=13267
2 changed files with 12 additions and 4 deletions

View File

@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* @(#)uipc_socket2.c 8.1 (Berkeley) 6/10/93
* $Id: uipc_socket2.c,v 1.6 1995/11/03 18:33:46 wollman Exp $
* $Id: uipc_socket2.c,v 1.7 1995/12/14 22:51:02 bde Exp $
*/
#include <sys/param.h>
@ -56,6 +56,10 @@
u_long sb_max = SB_MAX; /* XXX should be static */
SYSCTL_INT(_kern, KERN_MAXSOCKBUF, maxsockbuf, CTLFLAG_RW, &sb_max, 0, "")
static u_long sb_efficiency = 8; /* parameter for sbreserve() */
SYSCTL_INT(_kern, OID_AUTO, sockbuf_waste_factor, CTLFLAG_RW, &sb_efficiency,
0, "");
/*
* Procedures to manipulate state flags of socket
* and do appropriate wakeups. Normal sequence from the
@ -396,7 +400,7 @@ sbreserve(sb, cc)
if (cc > sb_max * MCLBYTES / (MSIZE + MCLBYTES))
return (0);
sb->sb_hiwat = cc;
sb->sb_mbmax = min(cc * 2, sb_max);
sb->sb_mbmax = min(cc * sb_efficiency, sb_max);
if (sb->sb_lowat > sb->sb_hiwat)
sb->sb_lowat = sb->sb_hiwat;
return (1);

View File

@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* @(#)uipc_socket2.c 8.1 (Berkeley) 6/10/93
* $Id: uipc_socket2.c,v 1.6 1995/11/03 18:33:46 wollman Exp $
* $Id: uipc_socket2.c,v 1.7 1995/12/14 22:51:02 bde Exp $
*/
#include <sys/param.h>
@ -56,6 +56,10 @@
u_long sb_max = SB_MAX; /* XXX should be static */
SYSCTL_INT(_kern, KERN_MAXSOCKBUF, maxsockbuf, CTLFLAG_RW, &sb_max, 0, "")
static u_long sb_efficiency = 8; /* parameter for sbreserve() */
SYSCTL_INT(_kern, OID_AUTO, sockbuf_waste_factor, CTLFLAG_RW, &sb_efficiency,
0, "");
/*
* Procedures to manipulate state flags of socket
* and do appropriate wakeups. Normal sequence from the
@ -396,7 +400,7 @@ sbreserve(sb, cc)
if (cc > sb_max * MCLBYTES / (MSIZE + MCLBYTES))
return (0);
sb->sb_hiwat = cc;
sb->sb_mbmax = min(cc * 2, sb_max);
sb->sb_mbmax = min(cc * sb_efficiency, sb_max);
if (sb->sb_lowat > sb->sb_hiwat)
sb->sb_lowat = sb->sb_hiwat;
return (1);