public inbox for passt-dev@passt.top
 help / color / mirror / code / Atom feed
From: David Gibson <david@gibson.dropbear.id.au>
To: Stefano Brivio <sbrivio@redhat.com>
Cc: passt-dev@passt.top, Tim Besard <tim.besard@gmail.com>
Subject: Re: [PATCH 1/2] tcp: Reset ACK_TO_TAP_DUE flag whenever an ACK isn't needed anymore
Date: Wed, 20 Nov 2024 11:58:31 +1100	[thread overview]
Message-ID: <Zz00N5w__1K-wYia@zatzit> (raw)
In-Reply-To: <20241119195344.3056010-2-sbrivio@redhat.com>

[-- Attachment #1: Type: text/plain, Size: 1706 bytes --]

On Tue, Nov 19, 2024 at 08:53:43PM +0100, Stefano Brivio wrote:
> We enter the timer handler with the ACK_TO_TAP_DUE flag, call
> tcp_prepare_flags() with ACK_IF_NEEDED, and realise that we
> acknowledged everything meanwhile, so we return early, but we also
> need to reset that flag to avoid unnecessarily scheduling the timer
> over and over again until more pending data appears.
> 
> I'm not sure if this fixes any real issue, but I've spotted this
> in several logs reported by users, including one where we have some
> unexpected bursts of high CPU load during TCP transfers at low rates,
> from https://github.com/containers/podman/issues/23686.
> 
> Link: https://github.com/containers/podman/discussions/24572
> Link: https://github.com/containers/podman/issues/23686
> Signed-off-by: Stefano Brivio <sbrivio@redhat.com>

Reviewed-by: David Gibson <david@gibson.dropbear.id.au>

> ---
>  tcp.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/tcp.c b/tcp.c
> index 6a98dfa..f357920 100644
> --- a/tcp.c
> +++ b/tcp.c
> @@ -1235,8 +1235,10 @@ int tcp_prepare_flags(const struct ctx *c, struct tcp_tap_conn *conn,
>  	int s = conn->sock;
>  
>  	if (SEQ_GE(conn->seq_ack_to_tap, conn->seq_from_tap) &&
> -	    !flags && conn->wnd_to_tap)
> +	    !flags && conn->wnd_to_tap) {
> +		conn_flag(c, conn, ~ACK_TO_TAP_DUE);
>  		return 0;
> +	}
>  
>  	if (getsockopt(s, SOL_TCP, TCP_INFO, &tinfo, &sl)) {
>  		conn_event(c, conn, CLOSED);

-- 
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 --]

  reply	other threads:[~2024-11-20  1:02 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-19 19:53 [PATCH 0/2] tcp: Handle keep-alives, avoid unnecessary timer scheduling Stefano Brivio
2024-11-19 19:53 ` [PATCH 1/2] tcp: Reset ACK_TO_TAP_DUE flag whenever an ACK isn't needed anymore Stefano Brivio
2024-11-20  0:58   ` David Gibson [this message]
2024-11-19 19:53 ` [PATCH 2/2] tcp: Acknowledge keep-alive segments, ignore them for the rest Stefano Brivio
2024-11-20  1:02   ` David Gibson
2024-11-20  6:43     ` Stefano Brivio
2024-11-21  2:38       ` David Gibson
2024-11-21  4:26         ` Stefano Brivio
2024-11-21  4:30           ` Stefano Brivio
2024-11-21  6:21           ` David Gibson
2024-11-21  9:23             ` Stefano Brivio
2024-11-21  9:32               ` David Gibson

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=Zz00N5w__1K-wYia@zatzit \
    --to=david@gibson.dropbear.id.au \
    --cc=passt-dev@passt.top \
    --cc=sbrivio@redhat.com \
    --cc=tim.besard@gmail.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).