Commit abc610e0 authored by Davidlohr Bueso's avatar Davidlohr Bueso Committed by Linus Torvalds

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.netSigned-off-by: default avatarDavidlohr Bueso <dave@stgolabs.net>
Reviewed-by: default avatarAndrew 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: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent c5a282e9
...@@ -1820,15 +1820,19 @@ static int ep_poll(struct eventpoll *ep, struct epoll_event __user *events, ...@@ -1820,15 +1820,19 @@ static int ep_poll(struct eventpoll *ep, struct epoll_event __user *events,
res = -EINTR; res = -EINTR;
break; break;
} }
if (ep_events_available(ep) || timed_out)
eavail = ep_events_available(ep);
if (eavail)
break; break;
if (signal_pending(current)) { if (signal_pending(current)) {
res = -EINTR; res = -EINTR;
break; break;
} }
if (!schedule_hrtimeout_range(to, slack, HRTIMER_MODE_ABS)) if (!schedule_hrtimeout_range(to, slack, HRTIMER_MODE_ABS)) {
timed_out = 1; timed_out = 1;
break;
}
} }
__set_current_state(TASK_RUNNING); __set_current_state(TASK_RUNNING);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment