From patchwork Thu Jun 28 14:20:57 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 10494063 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 5397F603EE for ; Thu, 28 Jun 2018 14:21:43 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 408FD2A492 for ; Thu, 28 Jun 2018 14:21:43 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3F37C2A513; Thu, 28 Jun 2018 14:21:43 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CE15F2A492 for ; Thu, 28 Jun 2018 14:21:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S966543AbeF1OVg (ORCPT ); Thu, 28 Jun 2018 10:21:36 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:46070 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S966479AbeF1OVe (ORCPT ); Thu, 28 Jun 2018 10:21:34 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=References:In-Reply-To:Message-Id: Date:Subject:Cc:To:From:Sender:Reply-To:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=AUXqB+WFjUhJ+gABmQL6iBqTP/3gykdCnNF6EF8xlUA=; b=eGFF9GLcD2DSF8kOcghnawt38 FLuaqrDdELdLhK2/XNv36/JVtJk1mXTdKhzZ8UWbSYuJe3o4h3XHKJN3N6zgphT/TKMH3jPIydH5u GhquruBmGA9DXze+16I3MnvkJkcL+ubPJmIV1clXXrc1g6oc/2xiSeSvypAy/1MC3dNXWjjOfT/1n azVR0NAySIxgPpVYgjoo0kRjeMqUOHEFP1LDB/BTKK7DwQ7bKe4UAFqpNR0N45h27f8Bs+qFNCVVH KZiM8BYMekRlwpLhs+akdEblYFsC2KqUIFkyp50o6AaadBKHUU2VbxpRZQI+7xqCFJk2DkjUWwny+ aFOwe/Ktw==; Received: from 213-225-7-116.nat.highway.a1.net ([213.225.7.116] helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1fYXne-0000jt-Qq; Thu, 28 Jun 2018 14:21:33 +0000 From: Christoph Hellwig To: Alexander Viro Cc: Linus Torvalds , linux-fsdevel@vger.kernel.org, netdev@vger.kernel.org, lkp@01.org Subject: [PATCH 4/6] net: remove busy polling from sock_get_poll_head Date: Thu, 28 Jun 2018 16:20:57 +0200 Message-Id: <20180628142059.10017-5-hch@lst.de> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180628142059.10017-1-hch@lst.de> References: <20180628142059.10017-1-hch@lst.de> X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Busy polling always comes from a synchronous poll context, so for now we can assume that it calls ->poll if present. Move the busy polling in sock_poll to the common block and remove it from sock_get_poll_head to prepare for the removal of the get_poll_head method. Signed-off-by: Christoph Hellwig --- net/socket.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/net/socket.c b/net/socket.c index 7cf037d21805..ca300c97b7ba 100644 --- a/net/socket.c +++ b/net/socket.c @@ -1135,7 +1135,6 @@ static struct wait_queue_head *sock_get_poll_head(struct file *file, if (!sock->ops->poll_mask) return NULL; - sock_poll_busy_loop(sock, events); return &sock->wq->wait; } @@ -1161,8 +1160,9 @@ static __poll_t sock_poll(struct file *file, poll_table *wait) struct socket *sock = file->private_data; __poll_t events = poll_requested_events(wait), mask = 0; + sock_poll_busy_loop(sock, events); + if (sock->ops->poll) { - sock_poll_busy_loop(sock, events); mask = sock->ops->poll(file, sock, wait); } else if (sock->ops->poll_mask) { sock_poll_wait(file, sock_get_poll_head(file, events), wait);