Re: [PATCH 5/6] fs/epoll: reduce the scope of wq lock in epoll_wait()
From: Davidlohr Bueso
Date: Fri Nov 09 2018 - 10:53:10 EST
Sorry, I just realized I forgot these fixlets when sending the v1.
diff --git a/fs/eventpoll.c b/fs/eventpoll.c
index ec14e5bcdaa9..c37729658c03 100644
--- a/fs/eventpoll.c
+++ b/fs/eventpoll.c
@@ -381,7 +381,7 @@ static void ep_nested_calls_init(struct nested_calls *ncalls)
*/
static inline int ep_events_available(struct eventpoll *ep)
{
- return !list_empty(&ep->rdllist) ||
+ return !list_empty_careful(&ep->rdllist) ||
READ_ONCE(ep->ovflist) != EP_UNACTIVE_PTR;
}
@@ -1820,8 +1820,9 @@ static int ep_poll(struct eventpoll *ep, struct epoll_event __user *events,
res = -EINTR;
break;
}
-
- if (ep_events_available(ep))
+
+ eavail = ep_events_available(ep);
+ if (eavail)
break;
if (signal_pending(current)) {
res = -EINTR;