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=202410 header.b=lSpcafuI; dkim-atps=neutral Received: from mail.ozlabs.org (gandalf.ozlabs.org [150.107.74.76]) by passt.top (Postfix) with ESMTPS id 4C16E5A061D for ; Wed, 20 Nov 2024 02:02:38 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gibson.dropbear.id.au; s=202410; t=1732064544; bh=h+tSNBFwQfEjnOil4IaYEWfCNlvj+QWwhLHqvnNFEgM=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=lSpcafuIZbH8K60lOs/yepGSqrtALkpaaBJyvY3yHTsKP9sK86VDpIIWSzeM6i6Ls 0Ay/se97eLFJ4VxBg+gk8k20NER/G2mPX+cSBsjKsQr4QMRUzJyNu0IjLk/SQRLIwm gVRWPBGFnrAB9MoL5KwDBrj3n5lnmzhBQ+oV7m6L+zfvBeQBn3dwM1OdFxmM5+rznS ZpVZPWm7tJwYQEPnC1aCg2y3FsqiH+jrCNAg7t8SmnnSy2hNykuvR9aqZnAOkBbQf0 cWvZrYe5Pf2bsdS5+PtRV3VJb5YA9pce33pbb2MM7+uuIg4FRerf8i1MNBo0tGE53q 1urCuDR6XOTfg== Received: by gandalf.ozlabs.org (Postfix, from userid 1007) id 4XtNPX6Wrxz4xqB; Wed, 20 Nov 2024 12:02:24 +1100 (AEDT) Date: Wed, 20 Nov 2024 11:58:31 +1100 From: David Gibson To: Stefano Brivio Subject: Re: [PATCH 1/2] tcp: Reset ACK_TO_TAP_DUE flag whenever an ACK isn't needed anymore Message-ID: References: <20241119195344.3056010-1-sbrivio@redhat.com> <20241119195344.3056010-2-sbrivio@redhat.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="L8zPvaKOy4ZPNU3M" Content-Disposition: inline In-Reply-To: <20241119195344.3056010-2-sbrivio@redhat.com> Message-ID-Hash: 5QINIUOKUCG5I3CITB65U43G66X6ADGI X-Message-ID-Hash: 5QINIUOKUCG5I3CITB65U43G66X6ADGI 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, Tim Besard 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: --L8zPvaKOy4ZPNU3M Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable 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. >=20 > 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. >=20 > Link: https://github.com/containers/podman/discussions/24572 > Link: https://github.com/containers/podman/issues/23686 > Signed-off-by: Stefano Brivio Reviewed-by: David Gibson > --- > tcp.c | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) >=20 > 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 =3D conn->sock; > =20 > 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; > + } > =20 > if (getsockopt(s, SOL_TCP, TCP_INFO, &tinfo, &sl)) { > conn_event(c, conn, CLOSED); --=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 --L8zPvaKOy4ZPNU3M Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEO+dNsU4E3yXUXRK2zQJF27ox2GcFAmc9NDYACgkQzQJF27ox 2Ge61A/9EvZIfLWL6SA2amfB+969Z6tRf5ENn97wt97qJ6gyEYsxjPuLfviHEGMR HGqqy9hSsvrJuLkFMKyn1OoX5PPj98EDBYtiVSZ7u5KFhMJi+bjw6xLHGCChB5v6 11Mg3OLvbZ6vC3EDgVdyq7bnZr0Fakz+t9RjX2dLoxK3Pkd7hR5qa5yAi+EQ5p8N IWCDTQ53LH8bKZxOl2ib7eSW8UWe8EGuDh1rS30c4MFlw9pThnlkClxFDhSRo+jd 0wWA8L17YlwgIwOVFqe/V7mIpMun3NWwNBZhK3/qtUSjjfCjmaOWHbYRXNWHS5j0 bZJ9vt4+LVticoFok77pZ15cVnp5IVxxTvVbga+1lOVu+VeWNMCmgkmQbLxpQm9F AycT7g31R9XKdGh8R8CNqPw7OsWrAOVyHJX3Kzfw5jP8X97rhQhbf5+oeKEcgGFb +Xcs0mVw/OHSlzQ5zWy42i0wPjL+uf8JkrXQCa3XSIyNLteHjOTWg62ajhYUR7zV RbDyJsuNgdV28C+XmovO9bxRiTH7kGKuZOUK4hZvEX+FTgwJvUy0X5YeYTtW0/xv ePCROYCQe+qWiTFWBl+0+Gn4GUTcj/VHE57I56i9weEfHUCovP4FH2RCDcaY8VgF w3b2p6J0EpbctTXTXuBu48fKAu+ualxjiPJjyWm26VZGVqeAlvg= =/KrP -----END PGP SIGNATURE----- --L8zPvaKOy4ZPNU3M--