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@xxxxxxxxxxxx> --- 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