From: Florian Westphal <fw at strlen.de>
To: mptcp at lists.01.org
Subject: [MPTCP] Re: [PATCH net-next 6/8] mptcp: avoid work queue scheduling if possible
Date: Tue, 25 Feb 2020 13:51:21 +0100 [thread overview]
Message-ID: <20200225125121.GJ19559@breakpoint.cc> (raw)
In-Reply-To: e39273fde8de31e82c35048cd758c48268518bff.camel@redhat.com
[-- Attachment #1: Type: text/plain, Size: 1090 bytes --]
Paolo Abeni <pabeni(a)redhat.com> wrote:
> > +/* In most cases we will be able to lock the mptcp socket. If its already
> > + * owned, we need to defer to the work queue to avoid ABBA deadlock.
> > + */
> > +static bool move_skbs_to_msk(struct mptcp_sock *msk, struct sock *ssk)
> > +{
> > + struct sock *sk = (struct sock *)msk;
> > + unsigned int moved = 0;
> > +
> > + if (sock_owned_by_user_nocheck(sk))
> > + return false;
> > +
> > + if (unlikely(!spin_trylock_bh(&sk->sk_lock.slock)))
> > + return false;
> > +
> > + /* must re-check after taking the lock */
> > + if (!sock_owned_by_user_nocheck(sk))
>
> Don't we additionally need a READ_ONCE() here and above ?
> Otherwise the compiler and/or CPU could merge the read?
Oh, right, at least first check needs READ_ONCE annotation, thanks.
> AFAICS sock_owned_by_user_nocheck() does not include the additional
> annotation.
>
> I think we could simply drop the first check (and always do the
> trylock)
The trylock would succeed however when socket is owned, leading to
a uneeded lock operation.
next reply other threads:[~2020-02-25 12:51 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-02-25 12:51 Florian Westphal [this message]
-- strict thread matches above, loose matches on Subject: below --
2020-02-25 12:55 [MPTCP] Re: [PATCH net-next 6/8] mptcp: avoid work queue scheduling if possible Florian Westphal
2020-02-25 12:40 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=20200225125121.GJ19559@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.