From: David Gibson <david@gibson.dropbear.id.au>
To: Stefano Brivio <sbrivio@redhat.com>
Cc: passt-dev@passt.top
Subject: Re: [PATCH] tcp_splice: A typo three years ago and SO_RCVLOWAT is gone
Date: Mon, 17 Feb 2025 14:49:39 +1100 [thread overview]
Message-ID: <Z7Kx0x8YMYRqIZ06@zatzit> (raw)
In-Reply-To: <20250216221216.2014593-1-sbrivio@redhat.com>
[-- Attachment #1: Type: text/plain, Size: 2045 bytes --]
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:
>
> if (!bitmap_isset(rcvlowat_set, conn - ts) &&
> readlen > (long)c->tcp.pipe_size / 10) {
>
> (note the !) became:
>
> if (conn->flags & lowat_set_flag &&
> readlen > (long)c->tcp.pipe_size / 10) {
>
> in the new tcp_splice_sock_handler().
>
> We want to check, there, if we should set SO_RCVLOWAT, only if we
> haven't set it already.
>
> But, instead, we're checking if it's already set before we set it, so
> we'll never set it, of course.
>
> 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.
>
> Fixes: e5eefe77435a ("tcp: Refactor to use events instead of states, split out spliced implementation")
> Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
Ouch.
Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
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(-)
>
> 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 >= (long)c->tcp.pipe_size * 10 / 100)
> continue;
>
> - if (conn->flags & lowat_set_flag &&
> + if (!(conn->flags & lowat_set_flag) &&
> readlen > (long)c->tcp.pipe_size / 10) {
> int lowat = c->tcp.pipe_size / 4;
>
--
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
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
next prev parent reply other threads:[~2025-02-17 3:57 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-16 22:12 [PATCH] tcp_splice: A typo three years ago and SO_RCVLOWAT is gone Stefano Brivio
2025-02-16 22:12 ` [PATCH] tcp_splice: Don't wake up on input data if we can't write it anywhere Stefano Brivio
2025-02-17 3:51 ` David Gibson
2025-02-17 3:49 ` David Gibson [this message]
2025-02-17 7:12 ` [PATCH] tcp_splice: A typo three years ago and SO_RCVLOWAT is gone Stefano Brivio
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Z7Kx0x8YMYRqIZ06@zatzit \
--to=david@gibson.dropbear.id.au \
--cc=passt-dev@passt.top \
--cc=sbrivio@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://passt.top/passt
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for IMAP folder(s).