Netdev List
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@lst.de>
To: netdev@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH 2/4] net: don not detour through struct sock to find the poll waitqueue
Date: Mon, 30 Jul 2018 09:42:11 +0200	[thread overview]
Message-ID: <20180730074213.16832-3-hch@lst.de> (raw)
In-Reply-To: <20180730074213.16832-1-hch@lst.de>

For any open socket file descriptor sock->sk->sk_wq->wait will always
point to sock->wq->wait.  That means we can do the shorter dereference
and removal a NULL check and don't have to not worry about any RCU
protection.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 include/net/sock.h | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/include/net/sock.h b/include/net/sock.h
index 762069bb0d8c..7927541101a8 100644
--- a/include/net/sock.h
+++ b/include/net/sock.h
@@ -2001,10 +2001,9 @@ static inline bool skwq_has_sleeper(struct socket_wq *wq)
 static inline void sock_poll_wait(struct file *filp, poll_table *p)
 {
 	struct socket *sock = filp->private_data;
-	wait_queue_head_t *wq = sk_sleep(sock->sk);
 
-	if (!poll_does_not_wait(p) && wq) {
-		poll_wait(filp, wq, p);
+	if (!poll_does_not_wait(p)) {
+		poll_wait(filp, &sock->wq->wait, p);
 		/* We need to be sure we are in sync with the
 		 * socket flags modification.
 		 *
-- 
2.18.0

  parent reply	other threads:[~2018-07-30  7:42 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-30  7:42 socket poll related cleanups v2 Christoph Hellwig
2018-07-30  7:42 ` [PATCH 1/4] net: simplify sock_poll_wait Christoph Hellwig
2018-07-30  7:42 ` Christoph Hellwig [this message]
2018-07-30  7:42 ` [PATCH 3/4] net: remove sock_poll_busy_loop Christoph Hellwig
2018-07-30  7:42 ` [PATCH 4/4] net: remove sock_poll_busy_flag Christoph Hellwig
2018-07-30 16:13 ` socket poll related cleanups v2 David Miller

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=20180730074213.16832-3-hch@lst.de \
    --to=hch@lst.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    /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