diff mbox series

[liburing,v2,09/12] expose CQ ring overflow state

Message ID 20220901093303.1974274-10-dylany@fb.com (mailing list archive)
State New
Headers show
Series Defer taskrun changes | expand

Commit Message

Dylan Yudaken Sept. 1, 2022, 9:33 a.m. UTC
Allow the application to easily view if the CQ ring is in overflow state in
case it would like to explicitly flush using io_uring_get_events.

Explicit flushing can be useful for applications that prefer to have
reduced latency on CQs than to process as many as possible.

Signed-off-by: Dylan Yudaken <dylany@fb.com>
---
 src/include/liburing.h | 9 +++++++++
 1 file changed, 9 insertions(+)
diff mbox series

Patch

diff --git a/src/include/liburing.h b/src/include/liburing.h
index 3c5097b255de..ca8fbd608901 100644
--- a/src/include/liburing.h
+++ b/src/include/liburing.h
@@ -1086,6 +1086,15 @@  static inline unsigned io_uring_cq_ready(const struct io_uring *ring)
 	return io_uring_smp_load_acquire(ring->cq.ktail) - *ring->cq.khead;
 }
 
+/*
+ * Returns true if there are overflow entries waiting to be flushed onto
+ * the CQ ring
+ */
+static inline bool io_uring_cq_has_overflow(const struct io_uring *ring)
+{
+	return IO_URING_READ_ONCE(*ring->sq.kflags) & IORING_SQ_CQ_OVERFLOW;
+}
+
 /*
  * Returns true if the eventfd notification is currently enabled
  */