diff --git a/fs/eventpoll.c b/fs/eventpoll.c index 9eea3f0272f4..1a7e322f4f87 100644 --- a/fs/eventpoll.c +++ b/fs/eventpoll.c @@ -671,7 +671,6 @@ static void ep_done_scan(struct eventpoll *ep, __pm_relax(ep->ws); if (!list_empty(&ep->rdllist)) { - smp_mb(); if (waitqueue_active(&ep->wq)) wake_up(&ep->wq); } @@ -1251,7 +1250,6 @@ static int ep_poll_callback(wait_queue_entry_t *wait, unsigned mode, int sync, v * Wake up ( if active ) both the eventpoll wait list and the ->poll() * wait list. */ - smp_mb(); if (waitqueue_active(&ep->wq)) { if ((epi->event.events & EPOLLEXCLUSIVE) && !(pollflags & POLLFREE)) { @@ -1624,7 +1622,6 @@ static int ep_insert(struct eventpoll *ep, const struct epoll_event *event, ep_pm_stay_awake(epi); /* Notify waiting tasks that events are available */ - smp_mb(); if (waitqueue_active(&ep->wq)) wake_up(&ep->wq); if (waitqueue_active(&ep->poll_wait)) @@ -1701,7 +1698,6 @@ static int ep_modify(struct eventpoll *ep, struct epitem *epi, ep_pm_stay_awake(epi); /* Notify waiting tasks that events are available */ - smp_mb(); if (waitqueue_active(&ep->wq)) wake_up(&ep->wq); if (waitqueue_active(&ep->poll_wait)) @@ -1956,11 +1952,8 @@ static int ep_poll(struct eventpoll *ep, struct epoll_event __user *events, * important. */ eavail = ep_events_available(ep); - if (!eavail) { - spin_lock(&ep->wq.lock); + if (!eavail) __add_wait_queue_exclusive(&ep->wq, &wait); - spin_unlock(&ep->wq.lock); - } write_unlock_irq(&ep->lock); @@ -1987,9 +1980,7 @@ static int ep_poll(struct eventpoll *ep, struct epoll_event __user *events, */ if (timed_out) eavail = list_empty(&wait.entry); - spin_lock(&ep->wq.lock); __remove_wait_queue(&ep->wq, &wait); - spin_unlock(&ep->wq.lock); write_unlock_irq(&ep->lock); } }