From: Christoph Hellwig 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 Message-ID: <20180727140214.1938-4-hch@lst.de> References: <20180727140214.1938-1-hch@lst.de> To: netdev@vger.kernel.org Return-path: Received: from bombadil.infradead.org ([198.137.202.133]:34036 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730475AbeG0PYa (ORCPT ); Fri, 27 Jul 2018 11:24:30 -0400 Received: from 089144192124.atnat0001.highway.a1.net ([89.144.192.124] helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1fj3K5-0007vX-02 for netdev@vger.kernel.org; Fri, 27 Jul 2018 14:02:25 +0000 In-Reply-To: <20180727140214.1938-1-hch@lst.de> Sender: netdev-owner@vger.kernel.org List-ID: 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 --- 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