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 Reviewed-by: David Gibson > --- > 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