From: Christoph Paasch <christoph.paasch@gmail.com>
To: Eric Dumazet <eric.dumazet@gmail.com>
Cc: Eric Dumazet <edumazet@google.com>,
"David S . Miller" <davem@davemloft.net>,
netdev <netdev@vger.kernel.org>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Jonathan Looney <jtl@netflix.com>,
Neal Cardwell <ncardwell@google.com>,
Tyler Hicks <tyhicks@canonical.com>,
Yuchung Cheng <ycheng@google.com>,
Bruce Curtis <brucec@netflix.com>,
Jonathan Lemon <jonathan.lemon@gmail.com>,
Dustin Marquess <dmarquess@apple.com>
Subject: Re: [PATCH net 2/4] tcp: tcp_fragment() should apply sane memory limits
Date: Mon, 17 Jun 2019 20:19:58 -0700 [thread overview]
Message-ID: <CALMXkpZ4isoXpFp_5=nVUcWrt5TofYVhpdAjv7LkCH7RFW1tYw@mail.gmail.com> (raw)
In-Reply-To: <03cbcfdf-58a4-dbca-45b1-8b17f229fa1d@gmail.com>
On Mon, Jun 17, 2019 at 7:28 PM Eric Dumazet <eric.dumazet@gmail.com> wrote:
>
>
>
> On 6/17/19 5:18 PM, Christoph Paasch wrote:
> >
> > Hi Eric, I now have a packetdrill test that started failing (see
> > below). Admittedly, a bit weird test with the SO_SNDBUF forced so low.
> >
> > Nevertheless, previously this test would pass, now it stalls after the
> > write() because tcp_fragment() returns -ENOMEM. Your commit-message
> > mentions that this could trigger when one sets SO_SNDBUF low. But,
> > here we have a complete stall of the connection and we never recover.
> >
> > I don't know if we care about this, but there it is :-)
>
> I guess it is WAI :)
>
> Honestly I am not sure we want to add code just to allow these degenerated use cases.
>
> Upstream kernels could check if rtx queue is empty or not, but this check will be not trivial to backport
>
>
> Can you test :
Yes, this does the trick for my packetdrill-test.
I wonder, is there a way we could end up in a situation where we can't
retransmit anymore?
For example, sk_wmem_queued has grown so much that the new test fails.
Then, if we legitimately need to fragment in __tcp_retransmit_skb() we
won't be able to do so. So we will never retransmit. And if no ACK
comes back in to make some room we are stuck, no?
Christoph
>
> diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c
> index 00c01a01b547ec67c971dc25a74c9258563cf871..06576540133806222f43d4a9532c5a929a2965b0 100644
> --- a/net/ipv4/tcp_output.c
> +++ b/net/ipv4/tcp_output.c
> @@ -1296,7 +1296,8 @@ int tcp_fragment(struct sock *sk, enum tcp_queue tcp_queue,
> if (nsize < 0)
> nsize = 0;
>
> - if (unlikely((sk->sk_wmem_queued >> 1) > sk->sk_sndbuf)) {
> + if (unlikely((sk->sk_wmem_queued >> 1) > sk->sk_sndbuf &&
> + !tcp_rtx_queue_empty(sk))) {
> NET_INC_STATS(sock_net(sk), LINUX_MIB_TCPWQUEUETOOBIG);
> return -ENOMEM;
> }
next prev parent reply other threads:[~2019-06-18 3:20 UTC|newest]
Thread overview: 36+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-06-17 17:03 [PATCH net 0/4] tcp: make sack processing more robust Eric Dumazet
2019-06-17 17:03 ` [PATCH net 1/4] tcp: limit payload size of sacked skbs Eric Dumazet
2019-06-17 17:14 ` Jonathan Lemon
2019-06-17 17:03 ` [PATCH net 2/4] tcp: tcp_fragment() should apply sane memory limits Eric Dumazet
2019-06-17 17:14 ` Jonathan Lemon
2019-06-18 0:18 ` Christoph Paasch
2019-06-18 2:28 ` Eric Dumazet
2019-06-18 3:19 ` Christoph Paasch [this message]
2019-06-18 3:44 ` Eric Dumazet
2019-06-18 3:53 ` Christoph Paasch
2019-06-18 4:08 ` Eric Dumazet
2019-07-10 18:23 ` Prout, Andrew - LLSC - MITLL
2019-07-10 18:28 ` Eric Dumazet
2019-07-10 18:53 ` Prout, Andrew - LLSC - MITLL
2019-07-10 19:26 ` Eric Dumazet
2019-07-11 7:28 ` Christoph Paasch
2019-07-11 9:19 ` Eric Dumazet
2019-07-11 18:26 ` Michal Kubecek
2019-07-11 18:50 ` Eric Dumazet
2019-07-11 10:18 ` Eric Dumazet
2019-07-11 17:14 ` Prout, Andrew - LLSC - MITLL
2019-07-11 18:28 ` Eric Dumazet
2019-07-11 19:04 ` Jonathan Lemon
2019-07-12 7:05 ` Eric Dumazet
2019-07-16 15:13 ` Prout, Andrew - LLSC - MITLL
2019-06-17 17:03 ` [PATCH net 3/4] tcp: add tcp_min_snd_mss sysctl Eric Dumazet
2019-06-17 17:15 ` Jonathan Lemon
2019-06-17 17:18 ` Tyler Hicks
2019-06-17 17:03 ` [PATCH net 4/4] tcp: enforce tcp_min_snd_mss in tcp_mtu_probing() Eric Dumazet
2019-06-17 17:16 ` Jonathan Lemon
2019-06-17 17:18 ` Tyler Hicks
2019-06-17 17:41 ` [PATCH net 0/4] tcp: make sack processing more robust David Miller
2019-08-02 19:02 [PATCH net 2/4] tcp: tcp_fragment() should apply sane memory limits Bernd
2019-08-02 19:14 ` Neal Cardwell
2019-08-02 19:58 ` Bernd
2019-08-14 14:41 ` Marcelo Ricardo Leitner
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CALMXkpZ4isoXpFp_5=nVUcWrt5TofYVhpdAjv7LkCH7RFW1tYw@mail.gmail.com' \
--to=christoph.paasch@gmail.com \
--cc=brucec@netflix.com \
--cc=davem@davemloft.net \
--cc=dmarquess@apple.com \
--cc=edumazet@google.com \
--cc=eric.dumazet@gmail.com \
--cc=gregkh@linuxfoundation.org \
--cc=jonathan.lemon@gmail.com \
--cc=jtl@netflix.com \
--cc=ncardwell@google.com \
--cc=netdev@vger.kernel.org \
--cc=tyhicks@canonical.com \
--cc=ycheng@google.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).