diff options
| author | Pavel Begunkov <asml.silence@gmail.com> | 2025-04-24 12:31:16 +0100 |
|---|---|---|
| committer | Jens Axboe <axboe@kernel.dk> | 2025-04-24 08:33:54 -0600 |
| commit | 62f666df765ecaf9cc1892ca056d5c071a335d85 (patch) | |
| tree | 91dfab1575bee899aff715fdab4481017af734f8 /io_uring/eventfd.c | |
| parent | 76f1cc98b23cefd1f0ae90c51f1fb837e5f46528 (diff) | |
io_uring/eventfd: dedup signalling helpers
Consolidate io_eventfd_flush_signal() and io_eventfd_signal(). Not much
of a difference for now, but it prepares it for following changes.
Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
Link: https://lore.kernel.org/r/5beecd4da65d8d2d83df499196f84b329387f6a2.1745493845.git.asml.silence@gmail.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'io_uring/eventfd.c')
| -rw-r--r-- | io_uring/eventfd.c | 26 |
1 files changed, 9 insertions, 17 deletions
diff --git a/io_uring/eventfd.c b/io_uring/eventfd.c index 100d5da94cb9..a9da2d0d7510 100644 --- a/io_uring/eventfd.c +++ b/io_uring/eventfd.c @@ -112,23 +112,16 @@ static struct io_ev_fd *io_eventfd_grab(struct io_ring_ctx *ctx) return NULL; } -void io_eventfd_signal(struct io_ring_ctx *ctx) +void io_eventfd_signal(struct io_ring_ctx *ctx, bool cqe_event) { + bool skip = false, put_ref = true; struct io_ev_fd *ev_fd; ev_fd = io_eventfd_grab(ctx); - if (ev_fd) - io_eventfd_release(ev_fd, __io_eventfd_signal(ev_fd)); -} - -void io_eventfd_flush_signal(struct io_ring_ctx *ctx) -{ - struct io_ev_fd *ev_fd; - - ev_fd = io_eventfd_grab(ctx); - if (ev_fd) { - bool skip, put_ref = true; + if (!ev_fd) + return; + if (cqe_event) { /* * Eventfd should only get triggered when at least one event * has been posted. Some applications rely on the eventfd @@ -142,12 +135,11 @@ void io_eventfd_flush_signal(struct io_ring_ctx *ctx) skip = ctx->cached_cq_tail == ev_fd->last_cq_tail; ev_fd->last_cq_tail = ctx->cached_cq_tail; spin_unlock(&ctx->completion_lock); - - if (!skip) - put_ref = __io_eventfd_signal(ev_fd); - - io_eventfd_release(ev_fd, put_ref); } + + if (!skip) + put_ref = __io_eventfd_signal(ev_fd); + io_eventfd_release(ev_fd, put_ref); } int io_eventfd_register(struct io_ring_ctx *ctx, void __user *arg, |
