summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJens Axboe <axboe@kernel.dk>2022-05-14 09:35:04 -0600
committerJens Axboe <axboe@kernel.dk>2022-05-14 09:35:04 -0600
commit846097febe8eedfbce550c584f023459d614fbf4 (patch)
tree088abc7e1fa00e9ee8ff8e47d92746c18618c2d3
parente597622672fcfdab486337b5a80be49cfe25a99c (diff)
downloadliburing-846097febe8eedfbce550c584f023459d614fbf4.tar.gz
liburing-846097febe8eedfbce550c584f023459d614fbf4.tar.bz2
queue: add new IORING_SQ_TASKRUN flag
Check it in cq_ring_needs_flush(), so that a peek operation will notice and enter the kernel to flush completions. Signed-off-by: Jens Axboe <axboe@kernel.dk>
-rw-r--r--src/include/liburing/io_uring.h1
-rw-r--r--src/queue.c3
2 files changed, 3 insertions, 1 deletions
diff --git a/src/include/liburing/io_uring.h b/src/include/liburing/io_uring.h
index bfb3548..3225d04 100644
--- a/src/include/liburing/io_uring.h
+++ b/src/include/liburing/io_uring.h
@@ -240,6 +240,7 @@ struct io_sqring_offsets {
*/
#define IORING_SQ_NEED_WAKEUP (1U << 0) /* needs io_uring_enter wakeup */
#define IORING_SQ_CQ_OVERFLOW (1U << 1) /* CQ ring is overflown */
+#define IORING_SQ_TASKRUN (1U << 2) /* task should enter the kernel */
struct io_cqring_offsets {
__u32 head;
diff --git a/src/queue.c b/src/queue.c
index 856d270..36b4b29 100644
--- a/src/queue.c
+++ b/src/queue.c
@@ -35,7 +35,8 @@ static inline bool sq_ring_needs_enter(struct io_uring *ring, unsigned *flags)
static inline bool cq_ring_needs_flush(struct io_uring *ring)
{
- return IO_URING_READ_ONCE(*ring->sq.kflags) & IORING_SQ_CQ_OVERFLOW;
+ return IO_URING_READ_ONCE(*ring->sq.kflags) &
+ (IORING_SQ_CQ_OVERFLOW | IORING_SQ_TASKRUN);
}
static inline bool cq_ring_needs_enter(struct io_uring *ring)