diff options
authorGlauber Costa <>2019-12-19 11:15:48 -0500
committerGlauber Costa <>2019-12-19 11:48:36 -0500
commitbf3aeb3dbbd7f41369ebcceb887cc081ffff7b75 (patch)
parenta4a015a2766e29124d5a8a6ce8e4975bdd3234ea (diff)
for polled IO, do not miss the opportunity of getting completions when going to the kernel
Right now the IORING_ENTER_GETEVENTS flag is set automatically when calling __io_uring_submit if the caller specifies requests to wait. However, when using polled I/O it is still legal and common to specify zero requests to wait for when we still want completions to happen if there are any available. One example of an application that would always specify zero requests is the Seastar framework. We always submit existing new requests, if any, and poll for I/O at pre-determined periods of time whether or not we expect I/O to have been completed. With the current behavior we are forced to issue a second system call if we want to getevents, or worse: not to rely on liburing at all and craft the queue magic by hand. This patch changes the behavior of __io_uring_submit to always include IORING_ENTER_GETEVENTS in case of polled I/O. Signed-off-by: Glauber Costa <>
1 files changed, 1 insertions, 1 deletions
diff --git a/src/queue.c b/src/queue.c
index 31dc479..965b0c9 100644
--- a/src/queue.c
+++ b/src/queue.c
@@ -187,7 +187,7 @@ static int __io_uring_submit(struct io_uring *ring, unsigned submitted,
flags = 0;
if (sq_ring_needs_enter(ring, &flags) || wait_nr) {
- if (wait_nr)
+ if (wait_nr || (ring->flags & IORING_SETUP_IOPOLL))
ret = __sys_io_uring_enter(ring->ring_fd, submitted, wait_nr,