Skip to content

Commit f337b9c

Browse files
davideltorvalds
authored andcommitted
epoll: drop unnecessary test
Thomas found that there is an unnecessary (always true) test in ep_send_events(). The callback never inserts into ->rdllink while the send loop is performed, and also does the ~EP_PRIVATE_BITS test. Given we're holding the mutex during this time, the conditions tested inside the loop are always true. This patch drops the test done inside the re-insertion loop. Signed-off-by: Davide Libenzi <[email protected]> Cc: Thomas Gleixner <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
1 parent 8b6e47a commit f337b9c

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

fs/eventpoll.c

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -927,14 +927,11 @@ static int ep_send_events(struct eventpoll *ep, struct epoll_event __user *event
927927
/*
928928
* During the time we spent in the loop above, some other events
929929
* might have been queued by the poll callback. We re-insert them
930-
* here (in case they are not already queued, or they're one-shot).
930+
* inside the main ready-list here.
931931
*/
932932
for (nepi = ep->ovflist; (epi = nepi) != NULL;
933-
nepi = epi->next, epi->next = EP_UNACTIVE_PTR) {
934-
if (!ep_is_linked(&epi->rdllink) &&
935-
(epi->event.events & ~EP_PRIVATE_BITS))
936-
list_add_tail(&epi->rdllink, &ep->rdllist);
937-
}
933+
nepi = epi->next, epi->next = EP_UNACTIVE_PTR)
934+
list_add_tail(&epi->rdllink, &ep->rdllist);
938935
/*
939936
* We need to set back ep->ovflist to EP_UNACTIVE_PTR, so that after
940937
* releasing the lock, events will be queued in the normal way inside

0 commit comments

Comments
 (0)