netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Miller <davem@davemloft.net>
To: willemdebruijn.kernel@gmail.com
Cc: baoyou.xie@gmail.com, willemb@google.com,
	viro@zeniv.linux.org.uk, gregkh@linuxfoundation.org,
	pombredanne@nexb.com, tklauser@distanz.ch, matthew@mjdsystems.ca,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] datagram: return from __skb_recv_datagram() as soon as possible
Date: Wed, 18 Jul 2018 14:15:59 +0900 (KST)	[thread overview]
Message-ID: <20180718.141559.1076017531577697883.davem@davemloft.net> (raw)
In-Reply-To: <CAF=yD-+N6BBcbKFo3B=FmVcp9VD+NUr2mfk-qkvtkVZYDhsRHQ@mail.gmail.com>

From: Willem de Bruijn <willemdebruijn.kernel@gmail.com>
Date: Mon, 16 Jul 2018 15:17:54 -0700

> If the above occurs, that implies that the queue is not empty so the
> next iteration of the loop in __skb_recv_datagram should return
> the oldest packet on the queue.

Isn't it possible, with two threads pulling from the socket in
parallel, for one of them to be constantly unable to pass that
test:

	if (sk->sk_receive_queue.prev != skb)
		goto out;

because the other one empties the queue too quickly every time?

We sample 'last' with the queue lock held, but the above test is done
without that lock.

      reply	other threads:[~2018-07-18  5:15 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-15 11:13 [PATCH v2] datagram: return from __skb_recv_datagram() as soon as possible Baoyou Xie
2018-07-16 22:17 ` Willem de Bruijn
2018-07-18  5:15   ` David Miller [this message]

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=20180718.141559.1076017531577697883.davem@davemloft.net \
    --to=davem@davemloft.net \
    --cc=baoyou.xie@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=matthew@mjdsystems.ca \
    --cc=netdev@vger.kernel.org \
    --cc=pombredanne@nexb.com \
    --cc=tklauser@distanz.ch \
    --cc=viro@zeniv.linux.org.uk \
    --cc=willemb@google.com \
    --cc=willemdebruijn.kernel@gmail.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).