From patchwork Wed Dec 12 11:03:56 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roman Penyaev X-Patchwork-Id: 10726099 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 01CB1112E for ; Wed, 12 Dec 2018 11:05:02 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E5E242A5A1 for ; Wed, 12 Dec 2018 11:05:01 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D692B2AEF3; Wed, 12 Dec 2018 11:05:01 +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.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI 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 5B2372A5A1 for ; Wed, 12 Dec 2018 11:05:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727274AbeLLLEd (ORCPT ); Wed, 12 Dec 2018 06:04:33 -0500 Received: from mx2.suse.de ([195.135.220.15]:46016 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727061AbeLLLEd (ORCPT ); Wed, 12 Dec 2018 06:04:33 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 66335AEFC; Wed, 12 Dec 2018 11:04:31 +0000 (UTC) From: Roman Penyaev Cc: Roman Penyaev , Davidlohr Bueso , Jason Baron , Al Viro , Andrew Morton , Linus Torvalds , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 2/3] epoll: loosen irq safety in ep_poll_callback() Date: Wed, 12 Dec 2018 12:03:56 +0100 Message-Id: <20181212110357.25656-3-rpenyaev@suse.de> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181212110357.25656-1-rpenyaev@suse.de> References: <20181212110357.25656-1-rpenyaev@suse.de> MIME-Version: 1.0 To: unlisted-recipients:; (no To-header on input) 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 Callers of the ep_poll_callback() (all set of wake_up_*poll()) disable interrupts, so no need to save/restore irq flags. Signed-off-by: Roman Penyaev Cc: Davidlohr Bueso Cc: Jason Baron Cc: Al Viro Cc: Andrew Morton Cc: Linus Torvalds Cc: linux-fsdevel@vger.kernel.org Cc: linux-kernel@vger.kernel.org --- fs/eventpoll.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/fs/eventpoll.c b/fs/eventpoll.c index 3627c2e07149..ea0025e77519 100644 --- a/fs/eventpoll.c +++ b/fs/eventpoll.c @@ -1124,13 +1124,15 @@ struct file *get_epoll_tfile_raw_ptr(struct file *file, int tfd, static int ep_poll_callback(wait_queue_entry_t *wait, unsigned mode, int sync, void *key) { int pwake = 0; - unsigned long flags; struct epitem *epi = ep_item_from_wait(wait); struct eventpoll *ep = epi->ep; __poll_t pollflags = key_to_poll(key); int ewake = 0; - spin_lock_irqsave(&ep->wq.lock, flags); + /* Interrupts are disabled by the wake_up_*poll() callers */ + lockdep_assert_irqs_disabled(); + + spin_lock(&ep->wq.lock); ep_set_busy_poll_napi_id(epi); @@ -1207,7 +1209,7 @@ static int ep_poll_callback(wait_queue_entry_t *wait, unsigned mode, int sync, v pwake++; out_unlock: - spin_unlock_irqrestore(&ep->wq.lock, flags); + spin_unlock(&ep->wq.lock); /* We have to call this outside the lock */ if (pwake)