netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@lst.de>
To: netdev@vger.kernel.org
Subject: [PATCH 3/5] net: don not detour through struct sock to find the poll waitqueue
Date: Fri, 27 Jul 2018 16:02:12 +0200	[thread overview]
Message-ID: <20180727140214.1938-4-hch@lst.de> (raw)
In-Reply-To: <20180727140214.1938-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 946ee8651714..9b6011912691 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-27 15:24 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-27 14:02 socket poll related cleanups Christoph Hellwig
2018-07-27 14:02 ` [PATCH 1/5] net: remove bogus RCU annotations on socket.wq Christoph Hellwig
2018-07-29 20:05   ` David Miller
2018-07-30  7:44     ` Christoph Hellwig
2018-07-30 16:09       ` David Miller
2018-07-27 14:02 ` [PATCH 2/5] net: simplify sock_poll_wait Christoph Hellwig
2018-07-27 14:02 ` Christoph Hellwig [this message]
2018-07-27 14:02 ` [PATCH 4/5] net: remove sock_poll_busy_loop Christoph Hellwig
2018-07-27 14:02 ` [PATCH 5/5] net: remove sock_poll_busy_flag Christoph Hellwig

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=20180727140214.1938-4-hch@lst.de \
    --to=hch@lst.de \
    --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;
as well as URLs for NNTP newsgroup(s).