summaryrefslogtreecommitdiff
path: root/fs
diff options
context:
space:
mode:
authorDavidlohr Bueso <dave@stgolabs.net>2019-01-03 15:27:19 -0800
committerLinus Torvalds <torvalds@linux-foundation.org>2019-01-04 13:13:46 -0800
commitabc610e01c663e25c41a3bdcbc4115cd7fbb047b (patch)
treebf1652615120062bc27a0dc5b6250974a81664cd /fs
parentc5a282e9635e9c7382821565083db5d260085e3e (diff)
fs/epoll: avoid barrier after an epoll_wait(2) timeout
Upon timeout, we can just exit out of the loop, without the cost of the changing the task's state with an smp_store_mb call. Just exit out of the loop and be done - setting the task state afterwards will be, of course, redundant. [dave@stgolabs.net: forgotten fixlets] Link: http://lkml.kernel.org/r/20181109155258.jxcr4t2pnz6zqct3@linux-r8p5 Link: http://lkml.kernel.org/r/20181108051006.18751-7-dave@stgolabs.net Signed-off-by: Davidlohr Bueso <dave@stgolabs.net> Reviewed-by: Andrew Morton <akpm@linux-foundation.org> Cc: Al Viro <viro@zeniv.linux.org.uk> Cc: Davidlohr Bueso <dbueso@suse.de> Cc: Jason Baron <jbaron@akamai.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs')
-rw-r--r--fs/eventpoll.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/fs/eventpoll.c b/fs/eventpoll.c
index b42f53d64d11..9beb166b7264 100644
--- a/fs/eventpoll.c
+++ b/fs/eventpoll.c
@@ -1820,15 +1820,19 @@ fetch_events:
res = -EINTR;
break;
}
- if (ep_events_available(ep) || timed_out)
+
+ eavail = ep_events_available(ep);
+ if (eavail)
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);