From: Davidlohr Bueso <dave@stgolabs.net>
To: akpm@linux-foundation.org
Cc: jbaron@akamai.com, viro@zeniv.linux.org.uk, dave@stgolabs.net,
linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH 6/6] fs/epoll: avoid barrier after an epoll_wait(2) timeout
Date: Wed, 7 Nov 2018 21:10:06 -0800 [thread overview]
Message-ID: <20181108051006.18751-7-dave@stgolabs.net> (raw)
In-Reply-To: <20181108051006.18751-1-dave@stgolabs.net>
Upon timeout, we can just exit out of the loop, without
the cost of the changing the task's state smp_store_mb
call. Just exit out of the loop and be done - setting
the task state afterwards will be, of course, redundant.
Signed-off-by: Davidlohr Bueso <dave@stgolabs.net>
---
fs/eventpoll.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/fs/eventpoll.c b/fs/eventpoll.c
index f6c023f085f6..ec14e5bcdaa9 100644
--- a/fs/eventpoll.c
+++ b/fs/eventpoll.c
@@ -1820,15 +1820,18 @@ static int ep_poll(struct eventpoll *ep, struct epoll_event __user *events,
res = -EINTR;
break;
}
- if (ep_events_available(ep) || timed_out)
+
+ if (ep_events_available(ep))
break;
if (signal_pending(current)) {
res = -EINTR;
break;
}
- if (!schedule_hrtimeout_range(to, slack, HRTIMER_MODE_ABS))
+ if (!schedule_hrtimeout_range(to, slack, HRTIMER_MODE_ABS)) {
timed_out = 1;
+ break;
+ }
}
__set_current_state(TASK_RUNNING);
--
2.16.4
prev parent reply other threads:[~2018-11-08 14:44 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-11-08 5:10 [PATCH -next 0/6] epoll: some miscellaneous optimizations Davidlohr Bueso
2018-11-08 5:10 ` [PATCH 1/6] fs/epoll: remove max_nests argument from ep_call_nested() Davidlohr Bueso
2018-11-08 5:10 ` [PATCH 2/6] fs/epoll: simplify ep_send_events_proc() ready-list loop Davidlohr Bueso
2018-11-08 5:10 ` [PATCH 3/6] fs/epoll: drop ovflist branch prediction Davidlohr Bueso
2018-11-08 5:10 ` [PATCH 4/6] fs/epoll: robustify ep->mtx held checks Davidlohr Bueso
2018-11-08 5:10 ` [PATCH 5/6] fs/epoll: reduce the scope of wq lock in epoll_wait() Davidlohr Bueso
2018-11-09 15:52 ` Davidlohr Bueso
2018-11-08 5:10 ` Davidlohr Bueso [this message]
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=20181108051006.18751-7-dave@stgolabs.net \
--to=dave@stgolabs.net \
--cc=akpm@linux-foundation.org \
--cc=jbaron@akamai.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.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).