lkml.org 
[lkml]   [2018]   [Nov]   [8]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 6/6] fs/epoll: avoid barrier after an epoll_wait(2) timeout
Date
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
\
 
 \ /
  Last update: 2018-11-08 06:11    [W:0.081 / U:0.128 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site