Skip to content

Commit

Permalink
tcp: do not call tcp_cleanup_rbuf() if we have a backlog
Browse files Browse the repository at this point in the history
Under pressure, tcp recvmsg() has logic to process the socket backlog,
but calls tcp_cleanup_rbuf() right before.

Avoiding sending ACK right before processing new segments makes
a lot of sense, as this decrease the number of ACK packets,
with no impact on effective ACK clocking.

Signed-off-by: Eric Dumazet <edumazet@google.com>
  • Loading branch information
Eric Dumazet authored and xanmod committed Jan 12, 2022
1 parent 6c55b20 commit 2c0abf2
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions net/ipv4/tcp.c
Expand Up @@ -2440,12 +2440,11 @@ static int tcp_recvmsg_locked(struct sock *sk, struct msghdr *msg, size_t len,
}
}

tcp_cleanup_rbuf(sk, copied);

if (copied >= target) {
/* Do not sleep, just process backlog. */
__sk_flush_backlog(sk);
} else {
tcp_cleanup_rbuf(sk, copied);
sk_defer_free_flush(sk);
sk_wait_data(sk, &timeo, last);
}
Expand Down

0 comments on commit 2c0abf2

Please sign in to comment.