Commit 7e55a19c authored by Stefano Garzarella's avatar Stefano Garzarella Committed by Jens Axboe

io_uring: add IORING_CQ_EVENTFD_DISABLED to the CQ ring flags

This new flag should be set/clear from the application to
disable/enable eventfd notifications when a request is completed
and queued to the CQ ring.

Before this patch, notifications were always sent if an eventfd is
registered, so IORING_CQ_EVENTFD_DISABLED is not set during the
initialization.

It will be up to the application to set the flag after initialization
if no notifications are required at the beginning.
Signed-off-by: default avatarStefano Garzarella <sgarzare@redhat.com>
Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent 0d9b5b3a
...@@ -1153,6 +1153,8 @@ static inline bool io_should_trigger_evfd(struct io_ring_ctx *ctx) ...@@ -1153,6 +1153,8 @@ static inline bool io_should_trigger_evfd(struct io_ring_ctx *ctx)
{ {
if (!ctx->cq_ev_fd) if (!ctx->cq_ev_fd)
return false; return false;
if (READ_ONCE(ctx->rings->cq_flags) & IORING_CQ_EVENTFD_DISABLED)
return false;
if (!ctx->eventfd_async) if (!ctx->eventfd_async)
return true; return true;
return io_wq_current_is_worker(); return io_wq_current_is_worker();
......
...@@ -209,6 +209,13 @@ struct io_cqring_offsets { ...@@ -209,6 +209,13 @@ struct io_cqring_offsets {
__u64 resv2; __u64 resv2;
}; };
/*
* cq_ring->flags
*/
/* disable eventfd notifications */
#define IORING_CQ_EVENTFD_DISABLED (1U << 0)
/* /*
* io_uring_enter(2) flags * io_uring_enter(2) flags
*/ */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment