diff mbox series

[liburing,09/11] expose CQ ring overflow state

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

Commit Message

Dylan Yudaken Aug. 15, 2022, 1:09 p.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 6b25c358c63f..47668c3f26a7 100644
--- a/src/include/liburing.h
+++ b/src/include/liburing.h
@@ -1064,6 +1064,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
  */