]> www.infradead.org Git - users/jedix/linux-maple.git/commit
tcp: add receive queue awareness in tcp_rcv_space_adjust()
authorEric Dumazet <edumazet@google.com>
Tue, 13 May 2025 19:39:12 +0000 (19:39 +0000)
committerJakub Kicinski <kuba@kernel.org>
Thu, 15 May 2025 18:30:08 +0000 (11:30 -0700)
commitea33537d82921e71f852ea2ed985acc562125efe
treeb7bd20c601e5b232f8a9f154ffb5efa86342c89d
parent63ad7dfedfaee60d9ab40f9f2ec4fb488fa9b1ec
tcp: add receive queue awareness in tcp_rcv_space_adjust()

If the application can not drain fast enough a TCP socket queue,
tcp_rcv_space_adjust() can overestimate tp->rcvq_space.space.

Then sk->sk_rcvbuf can grow and hit tcp_rmem[2] for no good reason.

Fix this by taking into acount the number of available bytes.

Keeping sk->sk_rcvbuf at the right size allows better cache efficiency.

Signed-off-by: Eric Dumazet <edumazet@google.com>
Reviewed-by: Wei Wang <weiwan@google.com>
Link: https://patch.msgid.link/20250513193919.1089692-5-edumazet@google.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
include/linux/tcp.h
net/ipv4/tcp_input.c