io_uring/eventfd: check for the need to async notifier earlier

It's not necessary to do this post grabbing a reference. With that, we
can drop the out goto path as well.

Link: https://lore.kernel.org/r/20240921080307.185186-3-axboe@kernel.dk
Signed-off-by: Jens Axboe <axboe@kernel.dk>
This commit is contained in:
Jens Axboe 2024-09-21 01:59:48 -06:00
parent 165126dc5e
commit 3c90b80df5

View File

@ -69,10 +69,10 @@ void io_eventfd_signal(struct io_ring_ctx *ctx)
*/ */
if (unlikely(!ev_fd)) if (unlikely(!ev_fd))
return; return;
if (ev_fd->eventfd_async && !io_wq_current_is_worker())
return;
if (!refcount_inc_not_zero(&ev_fd->refs)) if (!refcount_inc_not_zero(&ev_fd->refs))
return; return;
if (ev_fd->eventfd_async && !io_wq_current_is_worker())
goto out;
if (likely(eventfd_signal_allowed())) { if (likely(eventfd_signal_allowed())) {
eventfd_signal_mask(ev_fd->cq_ev_fd, EPOLL_URING_WAKE); eventfd_signal_mask(ev_fd->cq_ev_fd, EPOLL_URING_WAKE);
@ -82,7 +82,6 @@ void io_eventfd_signal(struct io_ring_ctx *ctx)
return; return;
} }
} }
out:
io_eventfd_put(ev_fd); io_eventfd_put(ev_fd);
} }