The branch stable/14 has been updated by ziaee:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=fdd58e7a1a9b2ca11e4d597787a167a1f5cc0056

commit fdd58e7a1a9b2ca11e4d597787a167a1f5cc0056
Author:     Gleb Smirnoff <[email protected]>
AuthorDate: 2025-08-22 16:22:25 +0000
Commit:     Alexander Ziaee <[email protected]>
CommitDate: 2026-12-04 07:59:01 +0000

    unix: increase net.local.(stream|seqpacket).(recv|send)space to 64 KiB
    
    The limit of 8 KiB comes straight from the 80-ies, when memory sizes were
    two orders of magnitude less.  Microbenchmarking clearly shows that
    increased maximum buffer size is needed to improve bulk transfer
    performance over unix(4).  Most operating system have larger default
    sizes.  This brings us another reason for increase.  A buggy application,
    that treats a stream socket as a datagram socket, shall work on Linux as
    long as its messages are smaller than socket buffer size without any
    issues 99.99% of time.  But on FreeBSD it will instantly fail.  In the
    ports system there are already applications that suggest increase of this
    sysctls for the application to work.  We don't want to be a bug catcher
    for bad applications in the default configuration.
    
    Note that buffer size increase will not increase memory usage even on a
    system with a million unix(4) sockets at normal runtime, as long as
    applications are written properly and receivers drain their sockets and
    system has enough CPU time for them to do that.
    
    Relnotes:               yes
    Reviewed by:            peter.lei_ieee.org, rscheff, tuexen
    Differential Revision:  https://reviews.freebsd.org/D51903
    
    (cherry picked from commit 72ddb6de1028426305df3ab6c81ff3834d5a69e5)
---
 sys/kern/uipc_usrreq.c | 15 ++++++---------
 1 file changed, 6 insertions(+), 9 deletions(-)

diff --git a/sys/kern/uipc_usrreq.c b/sys/kern/uipc_usrreq.c
index 84e48d9b8274..f544fc113958 100644
--- a/sys/kern/uipc_usrreq.c
+++ b/sys/kern/uipc_usrreq.c
@@ -149,15 +149,12 @@ static struct task        unp_defer_task;
  * and don't really want to reserve the sendspace.  Their recvspace should be
  * large enough for at least one max-size datagram plus address.
  */
-#ifndef PIPSIZ
-#define        PIPSIZ  8192
-#endif
-static u_long  unpst_sendspace = PIPSIZ;
-static u_long  unpst_recvspace = PIPSIZ;
-static u_long  unpdg_maxdgram = 8*1024;        /* support 8KB syslog msgs */
-static u_long  unpdg_recvspace = 16*1024;
-static u_long  unpsp_sendspace = PIPSIZ;       /* really max datagram size */
-static u_long  unpsp_recvspace = PIPSIZ;
+static u_long   unpst_sendspace = 64*1024;
+static u_long   unpst_recvspace = 64*1024;
+static u_long   unpdg_maxdgram = 8*1024;        /* support 8KB syslog msgs */
+static u_long   unpdg_recvspace = 16*1024;
+static u_long   unpsp_sendspace = 64*1024;
+static u_long   unpsp_recvspace = 64*1024;
 
 static SYSCTL_NODE(_net, PF_LOCAL, local, CTLFLAG_RW | CTLFLAG_MPSAFE, 0,
     "Local domain");

Reply via email to