mbox series

[net-next,v4,0/4] net: tcp: support probing OOM

Message ID 20230811025530.3510703-1-imagedong@tencent.com (mailing list archive)
Headers show
Series net: tcp: support probing OOM | expand

Message

Menglong Dong Aug. 11, 2023, 2:55 a.m. UTC
From: Menglong Dong <imagedong@tencent.com>

In this series, we make some small changes to make the tcp retransmission
become zero-window probes if the receiver drops the skb because of memory
pressure.

In the 1st patch, we reply a zero-window ACK if the skb is dropped
because out of memory, instead of dropping the skb silently.

In the 2nd patch, we allow a zero-window ACK to update the window.

In the 3rd patch, fix unexcepted socket die when snd_wnd is 0 in
tcp_retransmit_timer().

In the 4th patch, we refactor the debug message in tcp_retransmit_timer()
to make it more correct.

After these changes, the tcp can probe the OOM of the receiver forever.

Changes since v3:
- make the timeout "2 * TCP_RTO_MAX" in the 3rd patch
- tp->retrans_stamp is not based on jiffies and can't be compared with
  icsk->icsk_timeout in the 3rd patch. Fix it.
- introduce the 4th patch

Changes since v2:
- refactor the code to avoid code duplication in the 1st patch
- use after() instead of max() in tcp_rtx_probe0_timed_out()

Changes since v1:
- send 0 rwin ACK for the receive queue empty case when necessary in the
  1st patch
- send the ACK immediately by using the ICSK_ACK_NOW flag in the 1st
  patch
- consider the case of the connection restart from idle, as Neal comment,
  in the 3rd patch

Menglong Dong (4):
  net: tcp: send zero-window ACK when no memory
  net: tcp: allow zero-window ACK update the window
  net: tcp: fix unexcepted socket die when snd_wnd is 0
  net: tcp: refactor the dbg message in tcp_retransmit_timer()

 include/net/inet_connection_sock.h |  3 ++-
 net/ipv4/tcp_input.c               | 20 ++++++++++-----
 net/ipv4/tcp_output.c              | 14 +++++++---
 net/ipv4/tcp_timer.c               | 41 ++++++++++++++++++++++--------
 4 files changed, 56 insertions(+), 22 deletions(-)

Comments

Eric Dumazet Aug. 11, 2023, 7:39 a.m. UTC | #1
On Fri, Aug 11, 2023 at 5:01 AM <menglong8.dong@gmail.com> wrote:
>
> From: Menglong Dong <imagedong@tencent.com>
>
> In this series, we make some small changes to make the tcp retransmission
> become zero-window probes if the receiver drops the skb because of memory
> pressure.
>
> In the 1st patch, we reply a zero-window ACK if the skb is dropped
> because out of memory, instead of dropping the skb silently.
>
> In the 2nd patch, we allow a zero-window ACK to update the window.
>
> In the 3rd patch, fix unexcepted socket die when snd_wnd is 0 in
> tcp_retransmit_timer().
>
> In the 4th patch, we refactor the debug message in tcp_retransmit_timer()
> to make it more correct.
>
> After these changes, the tcp can probe the OOM of the receiver forever.
>
> Changes since v3:
> - make the timeout "2 * TCP_RTO_MAX" in the 3rd patch
> - tp->retrans_stamp is not based on jiffies and can't be compared with
>   icsk->icsk_timeout in the 3rd patch. Fix it.
> - introduce the 4th patch
>
> Changes since v2:
> - refactor the code to avoid code duplication in the 1st patch
> - use after() instead of max() in tcp_rtx_probe0_timed_out()
>
> Changes since v1:
> - send 0 rwin ACK for the receive queue empty case when necessary in the
>   1st patch
> - send the ACK immediately by using the ICSK_ACK_NOW flag in the 1st
>   patch
> - consider the case of the connection restart from idle, as Neal comment,
>   in the 3rd patch

SGTM, thanks.

Reviewed-by: Eric Dumazet <edumazet@google.com>
patchwork-bot+netdevbpf@kernel.org Aug. 13, 2023, 11:30 a.m. UTC | #2
Hello:

This series was applied to netdev/net-next.git (main)
by David S. Miller <davem@davemloft.net>:

On Fri, 11 Aug 2023 10:55:26 +0800 you wrote:
> From: Menglong Dong <imagedong@tencent.com>
> 
> In this series, we make some small changes to make the tcp retransmission
> become zero-window probes if the receiver drops the skb because of memory
> pressure.
> 
> In the 1st patch, we reply a zero-window ACK if the skb is dropped
> because out of memory, instead of dropping the skb silently.
> 
> [...]

Here is the summary with links:
  - [net-next,v4,1/4] net: tcp: send zero-window ACK when no memory
    https://git.kernel.org/netdev/net-next/c/e2142825c120
  - [net-next,v4,2/4] net: tcp: allow zero-window ACK update the window
    https://git.kernel.org/netdev/net-next/c/800a666141de
  - [net-next,v4,3/4] net: tcp: fix unexcepted socket die when snd_wnd is 0
    https://git.kernel.org/netdev/net-next/c/e89688e3e978
  - [net-next,v4,4/4] net: tcp: refactor the dbg message in tcp_retransmit_timer()
    https://git.kernel.org/netdev/net-next/c/031c44b7527a

You are awesome, thank you!