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=202502 header.b=fUUfF6Mv; dkim-atps=neutral Received: from mail.ozlabs.org (mail.ozlabs.org [IPv6:2404:9400:2221:ea00::3]) by passt.top (Postfix) with ESMTPS id 391265A0274 for ; Mon, 17 Feb 2025 04:57:08 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gibson.dropbear.id.au; s=202502; t=1739764617; bh=dhjBQGVV5aMVcTvZOPbfIpEmcvHVssFTMGHNCKH2Eq0=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=fUUfF6MvvFkykPEC0VNuqM+Xb71D/Wx5Wpm9uAg8OSkbhcBLTK/shAYgfS/wl9CtX YixMR9Rn0Bsg7x2wBd58jrm9wI0AjdG48uEBQTqH7WL28j1thfV6spwoNVYp/VSikN BsVk48pX8VAUeJMQYCl0e8260ewnYDTxBBjfuaShWGLiSOI4HoVY4GImbUSoEyrZsk NZ+3B+LO2oNKLy1hNqSXIOrG0RJV8qOxjQzI1Jn48gANazHA23KSzs/KnRPQ8nbsw4 p3RJxQ0BRHrTwxihHAZMrpoOdTlEIod4jicwSY4Ti/NmPIj4g0FkaSDq/htHd7/4O1 1pYZQQyT5RduQ== Received: by gandalf.ozlabs.org (Postfix, from userid 1007) id 4Yx83s46gJz4wyl; Mon, 17 Feb 2025 14:56:57 +1100 (AEDT) Date: Mon, 17 Feb 2025 14:49:39 +1100 From: David Gibson To: Stefano Brivio Subject: Re: [PATCH] tcp_splice: A typo three years ago and SO_RCVLOWAT is gone Message-ID: References: <20250216221216.2014593-1-sbrivio@redhat.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="DOzM1DbaEMShauOg" Content-Disposition: inline In-Reply-To: <20250216221216.2014593-1-sbrivio@redhat.com> Message-ID-Hash: 5DX7RMRSVGDJRDQ4KBHOSLZZJVXWBVA6 X-Message-ID-Hash: 5DX7RMRSVGDJRDQ4KBHOSLZZJVXWBVA6 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: --DOzM1DbaEMShauOg Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sun, Feb 16, 2025 at 11:12:15PM +0100, Stefano Brivio wrote: > In commit e5eefe77435a ("tcp: Refactor to use events instead of > states, split out spliced implementation"), this: >=20 > if (!bitmap_isset(rcvlowat_set, conn - ts) && > readlen > (long)c->tcp.pipe_size / 10) { >=20 > (note the !) became: >=20 > if (conn->flags & lowat_set_flag && > readlen > (long)c->tcp.pipe_size / 10) { >=20 > in the new tcp_splice_sock_handler(). >=20 > We want to check, there, if we should set SO_RCVLOWAT, only if we > haven't set it already. >=20 > But, instead, we're checking if it's already set before we set it, so > we'll never set it, of course. >=20 > Fix the check and re-enable the functionality, which should give us > improved CPU utilisation in non-interactive cases where we are not > transferring at full pipe capacity. >=20 > Fixes: e5eefe77435a ("tcp: Refactor to use events instead of states, spli= t out spliced implementation") > Signed-off-by: Stefano Brivio Ouch. Reviewed-by: David Gibson At least insofar as this clearly corrects towards the intended behaviour. Given that we inadvertently bee using RCVLOWAT for so long, I am a bit worried that this might expose deadlocks or stalls. But, I guess we debug that when we come to it. > --- > tcp_splice.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) >=20 > diff --git a/tcp_splice.c b/tcp_splice.c > index 8a39a6f..5d845c9 100644 > --- a/tcp_splice.c > +++ b/tcp_splice.c > @@ -556,7 +556,7 @@ eintr: > if (readlen >=3D (long)c->tcp.pipe_size * 10 / 100) > continue; > =20 > - if (conn->flags & lowat_set_flag && > + if (!(conn->flags & lowat_set_flag) && > readlen > (long)c->tcp.pipe_size / 10) { > int lowat =3D c->tcp.pipe_size / 4; > =20 --=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 --DOzM1DbaEMShauOg Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEO+dNsU4E3yXUXRK2zQJF27ox2GcFAmeysdIACgkQzQJF27ox 2Ge2QA/9HO3kt9Lxbwz/r0zPJEedzJ7F2ZGyA8CjkkbWDrsyQ09gQuQ6F4wGul3k Nc0y10dVPPtLzN6B4VTz6P5Qru86M8hinpZpOuPpS/GswALVEXJnTYTpZQTimtOm xixmo3RPOcxd+KchVlAmI7PEzZ3u2i5jvJ51VNZGZ2cO0K6DYttHxXJ28nW2IzY/ C7NbDMJ3STqAE94zs7o+Y0QFWSQNwHcCqV7FtJxnYipf0Rm/aqnH6wt80WD4/F+u +bzK/mfxUAbbFX1eJA9eS0uIzTMsyHuMaB44fT56WdQBaUJkjc2UnsrA4lesRtEs X6LLbV1BRYmJc7OH65drrWQzCGTI69nk5g5yzkH4tLeVFgtZvhgdlqDG+NDTZGOA 73Emjq7KimE1zRJ/H6WSsM3fOQlRHR3ou+EiHJKtK//Lsp0vJtkvmRxuQDppmwU3 JYjxFY1El5QIE/ZMoHcvRSS1LVBzLXdc4uq3bVNAqqrlZI8888ZLChoVmFVpFkdN w6RESouafxLB6mZiIAu2iLQgsXO1VhQfXRcNyqdL1nRqWwqh9y+iyGecyzf7LtEY fUKiQ0xtYWqrHQePTqYAupYUaQ/Hhu5JXdULl2i5pu+pNaqSoAl4YD0YLPiCJZ10 O0ShWvDfEJaMDxfyd/3xrX/QBB3wNdgZ7dlD9nc/D02D/AwGgyk= =0aP7 -----END PGP SIGNATURE----- --DOzM1DbaEMShauOg--