The patch titled Subject: epoll: unify awaking of wakeup source on ep_poll_callback() path has been added to the -mm tree. Its filename is epoll-unify-awaking-of-wakeup-source-on-ep_poll_callback-path.patch This patch should soon appear at http://ozlabs.org/~akpm/mmots/broken-out/epoll-unify-awaking-of-wakeup-source-on-ep_poll_callback-path.patch and later at http://ozlabs.org/~akpm/mmotm/broken-out/epoll-unify-awaking-of-wakeup-source-on-ep_poll_callback-path.patch Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/process/submit-checklist.rst when testing your code *** The -mm tree is included into linux-next and is updated there every 3-4 working days ------------------------------------------------------ From: Roman Penyaev <rpenyaev@xxxxxxx> Subject: epoll: unify awaking of wakeup source on ep_poll_callback() path Original comment "Activate ep->ws since epi->ws may get deactivated at any time" indeed sounds loud, but it is incorrect, because the path where we check epi->ws is a path where insert to ovflist happens, i.e. ep_scan_ready_list() has taken ep->mtx and waits for this callback to finish, thus ep_modify() (which unregisters wakeup source) waits for ep_scan_ready_list(). Here in this patch I simply call ep_pm_stay_awake_rcu(), which is a bit extra for this path (indirectly protected by main ep->mtx, so even rcu is not needed), but I do not want to create another naked __ep_pm_stay_awake() variant only for this particular case, so rcu variant is just better for all the cases. Link: http://lkml.kernel.org/r/20190103150104.17128-4-rpenyaev@xxxxxxx Signed-off-by: Roman Penyaev <rpenyaev@xxxxxxx> Cc: Davidlohr Bueso <dbueso@xxxxxxx> Cc: Jason Baron <jbaron@xxxxxxxxxx> Cc: Al Viro <viro@xxxxxxxxxxxxxxxxxx> Cc: "Paul E. McKenney" <paulmck@xxxxxxxxxxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- fs/eventpoll.c | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) --- a/fs/eventpoll.c~epoll-unify-awaking-of-wakeup-source-on-ep_poll_callback-path +++ a/fs/eventpoll.c @@ -1167,14 +1167,7 @@ static int ep_poll_callback(wait_queue_e if (epi->next == EP_UNACTIVE_PTR) { epi->next = READ_ONCE(ep->ovflist); WRITE_ONCE(ep->ovflist, epi); - if (epi->ws) { - /* - * Activate ep->ws since epi->ws may get - * deactivated at any time. - */ - __pm_stay_awake(ep->ws); - } - + ep_pm_stay_awake_rcu(epi); } goto out_unlock; } _ Patches currently in -mm which might be from rpenyaev@xxxxxxx are epoll-make-sure-all-elements-in-ready-list-are-in-fifo-order.patch epoll-loosen-irq-safety-in-ep_poll_callback.patch epoll-unify-awaking-of-wakeup-source-on-ep_poll_callback-path.patch epoll-use-rwlock-in-order-to-reduce-ep_poll_callback-contention.patch