History

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.

Stefano Garzarella committed 6 years ago

Commit 7e55a191 parent 0d9b5b32 files · +9 −0Browse files

Unified · Split

2 files
  1. fs/io_uring.c +2 −0
  2. include/uapi/linux/io_uring.h +7 −0
fs/io_uring.c+2−0
@@ -1153,6 +1153,8 @@ static inline bool io_should_trigger_evfd(struct io_ring_ctx *ctx) · 1152 unmodified lines
1153{1153{
1154 if (!ctx->cq_ev_fd)1154 if (!ctx->cq_ev_fd)
1155 return false;1155 return false;
1156 if (READ_ONCE(ctx->rings->cq_flags) & IORING_CQ_EVENTFD_DISABLED)
1157 return false;
1156 if (!ctx->eventfd_async)1158 if (!ctx->eventfd_async)
1157 return true;1159 return true;
1158 return io_wq_current_is_worker();1160 return io_wq_current_is_worker();
include/uapi/linux/io_uring.h+7−0
@@ -209,6 +209,13 @@ struct io_cqring_offsets { · 208 unmodified lines
209 __u64 resv2;209 __u64 resv2;
210};210};
211 211
212/*
213 * cq_ring->flags
214 */
215
216/* disable eventfd notifications */
217#define IORING_CQ_EVENTFD_DISABLED (1U << 0)
218
212/*219/*
213 * io_uring_enter(2) flags220 * io_uring_enter(2) flags
214 */221 */