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 net-next 8/8] mptcp: defer work schedule until mptcp lock is released
Date: Tue, 25 Feb 2020 13:54:08 +0100	[thread overview]
Message-ID: <20200225125408.GK19559@breakpoint.cc> (raw)
In-Reply-To: e570c24a581bd1ce734f7c5751ee3579d92069d1.camel@redhat.com

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

Paolo Abeni <pabeni(a)redhat.com> wrote:
> On Tue, 2020-02-25 at 13:05 +0100, Florian Westphal wrote:
> > Don't schedule the work queue right away, instead defer this
> > to the lock release callback.
> > 
> > This has the advantage that it will give recv path a chance to
> > complete -- this might have moved all pending packets from the
> > subflow to the mptcp receive queue, which allows to avoid another
> > schedule_work().
> > 
> > Signed-off-by: Florian Westphal <fw(a)strlen.de>
> > ---
> >  net/mptcp/protocol.c | 20 ++++++++++++++++++--
> >  1 file changed, 18 insertions(+), 2 deletions(-)
> > 
> > diff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c
> > index de6bd9d28116..f7c0d205b047 100644
> > --- a/net/mptcp/protocol.c
> > +++ b/net/mptcp/protocol.c
> > @@ -240,8 +240,15 @@ void mptcp_data_ready(struct sock *sk, struct sock *ssk)
> >  		return;
> >  
> >  	/* mptcp socket is busy, schedule worker */
> > -	if (schedule_work(&msk->work))
> > -		sock_hold((struct sock *)msk);
> > +	if (!test_and_set_bit(TCP_DELACK_TIMER_DEFERRED,
> > +			      &sk->sk_tsq_flags)) {
> > +		sock_hold(sk);
> 
> Here is the msk/sk socket lock always held by some other process?

Yes, why?

> I think the trylock in patch 6 from different subflows can collide with
> each other, so a try lock can fail even with !sk->sk_lock.owned

Not following, sorry.

> Or the process owning the msk sock lock when the previous check has
> been done can release it in the meanwhile.

Yes, why?

> In one of the above happens, can the TCP_DELACK_TIMER_DEFERRED delayed
> for a long time? Do we need to address that scenario?

Hmm:
        /* mptcp socket is busy, schedule worker */
        if (!test_and_set_bit(TCP_DELACK_TIMER_DEFERRED,
                              &sk->sk_tsq_flags)) {
                sock_hold(sk);

                /* need to try again, its possible release_cb() has already
                 * been called after the test_and_set_bit() above.
                 */
                move_skbs_to_msk(msk, ssk);
        }

I thought the last move_skbs_to_msk() would address that?
(If it fails, msk is still owned so release cb will be called 'soon').

             reply	other threads:[~2020-02-25 12:54 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-25 12:54 Florian Westphal [this message]
  -- strict thread matches above, loose matches on Subject: below --
2020-02-25 16:35 [MPTCP] Re: [PATCH net-next 8/8] mptcp: defer work schedule until mptcp lock is released Paolo Abeni
2020-02-25 16:18 Florian Westphal
2020-02-25 14:53 Paolo Abeni
2020-02-25 12:50 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=20200225125408.GK19559@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.