From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: passt.top; dmarc=none (p=none dis=none) header.from=gibson.dropbear.id.au Authentication-Results: passt.top; dkim=pass (2048-bit key; secure) header.d=gibson.dropbear.id.au header.i=@gibson.dropbear.id.au header.a=rsa-sha256 header.s=202412 header.b=EBQWmS2h; dkim-atps=neutral Received: from mail.ozlabs.org (mail.ozlabs.org [IPv6:2404:9400:2221:ea00::3]) by passt.top (Postfix) with ESMTPS id 693C05A0272 for ; Tue, 21 Jan 2025 04:01:51 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gibson.dropbear.id.au; s=202412; t=1737428492; bh=8dPELeP4FflzlQkBSCTjX6XP0p+Moe0SQ6pIeYab63c=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=EBQWmS2he7Pem8g+FH7uV9xKjVajQCb3/ntqEzKZ5eoZYK7omOLozAyRElFXyJxog lMarW3FhPqubEbdnoY+DQPVHmqanr0pvV6dWVvJvmNhbpdIN4SCPsiUdwQ8EygPWng wb9LX5qJnFZq3x1A9w4j5LBxgmXvjeCSxIeURLKFy5KMVKj2beUHOLcf0PYYyuV6oG QcMvuCxbFYiYQwc/VdzMm+gFbMhHoOCp64rCIbdUhVlxmTrN71qCCfOjoYrxzn8mMu ZOgviUUP4VvlSdkjM8W7zGktpIy3M6C9HvzH9+vG17vpiT/XrCu7BGP8jHAzg45zZL 6aKzoT9vW2TzQ== Received: by gandalf.ozlabs.org (Postfix, from userid 1007) id 4YcX6N524Sz4x8f; Tue, 21 Jan 2025 14:01:32 +1100 (AEDT) Date: Tue, 21 Jan 2025 13:27:38 +1030 From: David Gibson To: Stefano Brivio Subject: Re: [PATCH] tcp: Buffer sizes are *not* inherited on accept()/accept4() Message-ID: References: <20250120172636.2102207-1-sbrivio@redhat.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="meubLRpL98Se2aBf" Content-Disposition: inline In-Reply-To: <20250120172636.2102207-1-sbrivio@redhat.com> Message-ID-Hash: RU5HFEGFDV2434JWO32JFCSTUZGISLXB X-Message-ID-Hash: RU5HFEGFDV2434JWO32JFCSTUZGISLXB X-MailFrom: dgibson@gandalf.ozlabs.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: passt-dev@passt.top X-Mailman-Version: 3.3.8 Precedence: list List-Id: Development discussion and patches for passt Archived-At: Archived-At: List-Archive: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: --meubLRpL98Se2aBf Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Jan 20, 2025 at 06:26:36PM +0100, Stefano Brivio wrote: > ...so it's pointless to set SO_RCVBUF and SO_SNDBUF on listening > sockets. >=20 > Call tcp_sock_set_bufsize() after accept4(), for inbound sockets. >=20 > As we didn't have large buffer sizes set for inbound sockets for > a long time (they are set explicitly only if the maximum size is > big enough, more than than the ~200 KiB default), I ran some more > throughput tests for this one, and I see slightly better numbers > (say, 17 gbps instead of 15 gbps guest to host without vhost-user). >=20 > Fixes: 904b86ade7db ("tcp: Rework window handling, timers, add SO_RCVLOWA= T and pools for sockets/pipes") > Signed-off-by: Stefano Brivio Reviewed-by: David Gibson > --- > tcp.c | 11 ++++------- > 1 file changed, 4 insertions(+), 7 deletions(-) >=20 > diff --git a/tcp.c b/tcp.c > index 3b3193a..a012b81 100644 > --- a/tcp.c > +++ b/tcp.c > @@ -2057,6 +2057,8 @@ void tcp_listen_handler(const struct ctx *c, union = epoll_ref ref, > if (s < 0) > goto cancel; > =20 > + tcp_sock_set_bufsize(c, s); > + > /* FIXME: When listening port has a specific bound address, record that > * as our address > */ > @@ -2260,7 +2262,6 @@ static int tcp_sock_init_one(const struct ctx *c, c= onst union inany_addr *addr, > if (s < 0) > return s; > =20 > - tcp_sock_set_bufsize(c, s); > return s; > } > =20 > @@ -2317,9 +2318,7 @@ static void tcp_ns_sock_init4(const struct ctx *c, = in_port_t port) > =20 > s =3D pif_sock_l4(c, EPOLL_TYPE_TCP_LISTEN, PIF_SPLICE, &inany_loopback= 4, > NULL, port, tref.u32); > - if (s >=3D 0) > - tcp_sock_set_bufsize(c, s); > - else > + if (s < 0) > s =3D -1; > =20 > if (c->tcp.fwd_out.mode =3D=3D FWD_AUTO) > @@ -2343,9 +2342,7 @@ static void tcp_ns_sock_init6(const struct ctx *c, = in_port_t port) > =20 > s =3D pif_sock_l4(c, EPOLL_TYPE_TCP_LISTEN, PIF_SPLICE, &inany_loopback= 6, > NULL, port, tref.u32); > - if (s >=3D 0) > - tcp_sock_set_bufsize(c, s); > - else > + if (s < 0) > s =3D -1; > =20 > if (c->tcp.fwd_out.mode =3D=3D FWD_AUTO) --=20 David Gibson (he or they) | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you, not the other way | around. http://www.ozlabs.org/~dgibson --meubLRpL98Se2aBf Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEO+dNsU4E3yXUXRK2zQJF27ox2GcFAmePDRQACgkQzQJF27ox 2GfgmRAAqcNxq7dPOh3NvvweyOEeR+VTwAxLgSeitAfNzC/moEaVYLj94mMwVAVo rQnLlzGzIMI4wVu/JzjvqqCT1/ppgK1WUpJWp8qEvsgT30DiKHfu8DkRmKCqB9rU p1KEF2W3bBgfnSyqRsXc3x255lbXYeekl0cJkfJxhVknKjJXvmpJx7uRfHQw5+ju MndO1rYWCLnjWgNBc6QVyjYEr2SBlOXxDz0dA0nT89AOrepkj0aIaxO7LXWDGSxa cPQELTaTEJwl39Ik/A3olbnO/JkYF7VNmmR7PsZyxXTEmL1AHv1RwsyO0kucDlmF WnDyNoHwWGiG1fZ4PkGyD+NwIhZ4JzYGHp7+v4NvXogu2vEsW79YHnsO6LmYQVjh C5RDTOeJSWMOW8BMPhbs+sLxj34ZdbpJRyuj8aKDIWZ3gwjObcxA5Zg6mcaJUfZe HX3Wvc3XMKt2R/jgB7DoECxOmoRWXXdKxbxE1aHQn3HtZKwAGzkqi0941zWlDorl pVG+Bf/b/rDwcTJi4enU2TjjYB1Ql43/sA/1Xk8htmyrcoDfvF4zCKWzqdHi+kzd PYlUtL0FX/V/J32kr0ZNW1x5v78NZtzk050Euq/CFzeKQNqCnW3Bf19g+Bh9xCdh C7tJr2c0cq4UPpaqeZyDze5hlAl1lIS+Fteh43RVhBYcdKGApts= =i2lF -----END PGP SIGNATURE----- --meubLRpL98Se2aBf--