From: Roman Penyaev <rpenyaev@suse.de>
To: unlisted-recipients:; (no To-header on input)
Cc: Roman Penyaev <rpenyaev@suse.de>,
Davidlohr Bueso <dbueso@suse.de>, Jason Baron <jbaron@akamai.com>,
Al Viro <viro@zeniv.linux.org.uk>,
Andrew Morton <akpm@linux-foundation.org>,
Linus Torvalds <torvalds@linux-foundation.org>,
linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH v2 2/4] epoll: loosen irq safety in ep_poll_callback()
Date: Thu, 3 Jan 2019 16:01:02 +0100 [thread overview]
Message-ID: <20190103150104.17128-3-rpenyaev@suse.de> (raw)
In-Reply-To: <20190103150104.17128-1-rpenyaev@suse.de>
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 <rpenyaev@suse.de>
Cc: Davidlohr Bueso <dbueso@suse.de>
Cc: Jason Baron <jbaron@akamai.com>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: linux-fsdevel@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
---
fs/eventpoll.c | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/fs/eventpoll.c b/fs/eventpoll.c
index 3627c2e07149..3c373a510f65 100644
--- a/fs/eventpoll.c
+++ b/fs/eventpoll.c
@@ -1124,13 +1124,18 @@ 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);
+ /*
+ * Called by irq context or 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 +1212,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)
--
2.19.1
next prev parent reply other threads:[~2019-01-03 15:01 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-01-03 15:01 [PATCH v2 0/4] use rwlock in order to reduce ep_poll_callback() contention Roman Penyaev
2019-01-03 15:01 ` [PATCH v2 1/4] epoll: make sure all elements in ready list are in FIFO order Roman Penyaev
2019-01-03 15:01 ` Roman Penyaev [this message]
2019-01-03 15:01 ` [PATCH v2 3/4] epoll: unify awaking of wakeup source on ep_poll_callback() path Roman Penyaev
2019-01-03 15:01 ` [PATCH v2 4/4] epoll: use rwlock in order to reduce ep_poll_callback() contention Roman Penyaev
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=20190103150104.17128-3-rpenyaev@suse.de \
--to=rpenyaev@suse.de \
--cc=akpm@linux-foundation.org \
--cc=dbueso@suse.de \
--cc=jbaron@akamai.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=torvalds@linux-foundation.org \
--cc=viro@zeniv.linux.org.uk \
/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).