All of lore.kernel.org
 help / color / mirror / Atom feed
From: Florian Westphal <fw at strlen.de>
To: mptcp at lists.01.org
Subject: [MPTCP] Re: [PATCH mptcp-next 3/7] mptcp: avoid blocking in tcp_sendpages due to skb alloc
Date: Thu, 07 May 2020 13:44:08 +0200	[thread overview]
Message-ID: <20200507114408.GM32392@breakpoint.cc> (raw)
In-Reply-To: ed85f8652b22c3c7f7f8cfa83e5c8973303621e7.camel@redhat.com

[-- Attachment #1: Type: text/plain, Size: 1927 bytes --]

Paolo Abeni <pabeni(a)redhat.com> wrote:
> On Wed, 2020-05-06 at 15:02 +0200, Florian Westphal wrote:
> > If memory is tight, tcp_sendpages may fail because it can't
> > allocate the skb head.
> > 
> > Now that we pass DONTWAIT to tcp_sendpages it won't block anymore on the
> > subflow socket when this happens.
> > 
> > We can avoid such allocation failure in tcp code by preallocating an skb
> > skb when we pick the subflow to use.
> 
> The sk_tx_skb_cache usage caused some TCP regression upstream:
> 
> commit 0b7d7f6b22084a3156f267c85303908a8f4c9a08
> Author: Eric Dumazet <edumazet(a)google.com>
> Date:   Fri Jun 14 16:22:20 2019 -0700
> 
>     tcp: add tcp_tx_skb_cache sysctl
> 
> but that one was not very clear and I guess does not matter for MPTCP -
> lacking an established baseline.
> 
> So all good ;)
> 
> > @@ -656,9 +677,13 @@ static int mptcp_sendmsg_frag(struct sock *sk, struct sock *ssk,
> >  static struct sock *mptcp_subflow_get_send(struct mptcp_sock *msk)
> >  {
> >  	struct mptcp_subflow_context *subflow;
> > +	struct sock *sk = (struct sock *)msk;
> >  	struct sock *backup = NULL;
> >  
> > -	sock_owned_by_me((const struct sock *)msk);
> > +	sock_owned_by_me(sk);
> > +
> > +	if (!mptcp_sendmsg_alloc_skb(sk))
> > +		return NULL;
> >  
> >  	mptcp_for_each_subflow(msk, subflow) {
> >  		struct sock *ssk = mptcp_subflow_tcp_sock(subflow);
> 
> Don't we need the same for mptcp_subflow_get_retrans() ?

Its optional.  If allocation doesn't fail there is no difference.

If it fails then as-is, mptcp_sendmsg_frag will return -EAGAIN and
no packet is sent.

If I'd add mptcp_sendmsg_alloc_skb() call to the worker, then it
would bail our right before (and would not sleep either).

So the end result is the same: no retransmission takes place.

Let me know if you prefer explicit mptcp_sendmsg_alloc_skb()
for retransmit case too.

Thanks!

             reply	other threads:[~2020-05-07 11:44 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-07 11:44 Florian Westphal [this message]
  -- strict thread matches above, loose matches on Subject: below --
2020-05-07 14:38 [MPTCP] Re: [PATCH mptcp-next 3/7] mptcp: avoid blocking in tcp_sendpages due to skb alloc Paolo Abeni
2020-05-07 14:33 Florian Westphal
2020-05-07 14:13 Paolo Abeni
2020-05-07 11:27 Paolo Abeni

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=20200507114408.GM32392@breakpoint.cc \
    --to=unknown@example.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.