Date: Fri, 17 Jan 2025 19:44:30 GMT From: Eugene Grosbein <eugen@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org Subject: git: c348cdf13257 - stable/14 - sockets: virtualize kern.ipc.soacceptqueue Message-ID: <202501171944.50HJiUJZ061376@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
The branch stable/14 has been updated by eugen: URL: https://cgit.FreeBSD.org/src/commit/?id=c348cdf132572ab821f7c75a97453c1d238239b9 commit c348cdf132572ab821f7c75a97453c1d238239b9 Author: Gleb Smirnoff <glebius@FreeBSD.org> AuthorDate: 2025-01-13 18:08:51 +0000 Commit: Eugene Grosbein <eugen@FreeBSD.org> CommitDate: 2025-01-17 19:44:15 +0000 sockets: virtualize kern.ipc.soacceptqueue PR: 219655 Differential Revision: https://reviews.freebsd.org/D48314 (cherry picked from commit 4155be454c46bc1ab725aca5c6969b064b74be38) --- sys/kern/uipc_socket.c | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/sys/kern/uipc_socket.c b/sys/kern/uipc_socket.c index 1e49b9b20588..fcec1ef166fc 100644 --- a/sys/kern/uipc_socket.c +++ b/sys/kern/uipc_socket.c @@ -240,38 +240,39 @@ struct splice32 { * NB: The original sysctl somaxconn is still available but hidden * to prevent confusion about the actual purpose of this number. */ -static u_int somaxconn = SOMAXCONN; +VNET_DEFINE_STATIC(u_int, somaxconn) = SOMAXCONN; +#define V_somaxconn VNET(somaxconn) static int sysctl_somaxconn(SYSCTL_HANDLER_ARGS) { int error; - int val; + u_int val; - val = somaxconn; + val = V_somaxconn; error = sysctl_handle_int(oidp, &val, 0, req); if (error || !req->newptr ) return (error); /* * The purpose of the UINT_MAX / 3 limit, is so that the formula - * 3 * so_qlimit / 2 + * 3 * sol_qlimit / 2 * below, will not overflow. */ if (val < 1 || val > UINT_MAX / 3) return (EINVAL); - somaxconn = val; + V_somaxconn = val; return (0); } SYSCTL_PROC(_kern_ipc, OID_AUTO, soacceptqueue, - CTLTYPE_UINT | CTLFLAG_RW | CTLFLAG_MPSAFE, 0, sizeof(int), - sysctl_somaxconn, "I", + CTLTYPE_UINT | CTLFLAG_RW | CTLFLAG_MPSAFE | CTLFLAG_VNET, 0, sizeof(u_int), + sysctl_somaxconn, "IU", "Maximum listen socket pending connection accept queue size"); SYSCTL_PROC(_kern_ipc, KIPC_SOMAXCONN, somaxconn, - CTLTYPE_UINT | CTLFLAG_RW | CTLFLAG_SKIP | CTLFLAG_MPSAFE, 0, - sizeof(int), sysctl_somaxconn, "I", + CTLTYPE_UINT | CTLFLAG_RW | CTLFLAG_SKIP | CTLFLAG_MPSAFE | CTLFLAG_VNET, 0, + sizeof(u_int), sysctl_somaxconn, "IU", "Maximum listen socket pending connection accept queue size (compat)"); static u_int numopensockets; @@ -1516,8 +1517,8 @@ solisten_proto(struct socket *so, int backlog) so->so_options |= SO_ACCEPTCONN; listening: - if (backlog < 0 || backlog > somaxconn) - backlog = somaxconn; + if (backlog < 0 || backlog > V_somaxconn) + backlog = V_somaxconn; so->sol_qlimit = backlog; mtx_unlock(&so->so_snd_mtx);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202501171944.50HJiUJZ061376>