engines/io_uring: set coop taskrun, single issuer and defer taskrun
authorAnkit Kumar <ankit.kumar@samsung.com>
Tue, 11 Oct 2022 10:59:35 +0000 (16:29 +0530)
committerJens Axboe <axboe@kernel.dk>
Wed, 12 Oct 2022 13:19:35 +0000 (07:19 -0600)
Add missing changes to io_uring_cmd I/O engine for COOP_TASKRUN
This was introduced for io_uring in commit 4d22c103

Add missing changes to io_uring_cmd I/O engine to set single issuer
and defer taskrun. This was introduced for io_uring in commit e453f369

Signed-off-by: Ankit Kumar <ankit.kumar@samsung.com>
Link: https://lore.kernel.org/r/20221011105935.10455-2-ankit.kumar@samsung.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
engines/io_uring.c

index c679177fb4765cd4cdf4777588af77f7d0794e5c..6906e0a4737304d44a5befaae74bb4e10b4b84fa 100644 (file)
@@ -889,9 +889,30 @@ static int fio_ioring_cmd_queue_init(struct thread_data *td)
        p.flags |= IORING_SETUP_CQSIZE;
        p.cq_entries = depth;
 
+       /*
+        * Setup COOP_TASKRUN as we don't need to get IPI interrupted for
+        * completing IO operations.
+        */
+       p.flags |= IORING_SETUP_COOP_TASKRUN;
+
+       /*
+        * io_uring is always a single issuer, and we can defer task_work
+        * runs until we reap events.
+        */
+       p.flags |= IORING_SETUP_SINGLE_ISSUER | IORING_SETUP_DEFER_TASKRUN;
+
 retry:
        ret = syscall(__NR_io_uring_setup, depth, &p);
        if (ret < 0) {
+               if (errno == EINVAL && p.flags & IORING_SETUP_DEFER_TASKRUN) {
+                       p.flags &= ~IORING_SETUP_DEFER_TASKRUN;
+                       p.flags &= ~IORING_SETUP_SINGLE_ISSUER;
+                       goto retry;
+               }
+               if (errno == EINVAL && p.flags & IORING_SETUP_COOP_TASKRUN) {
+                       p.flags &= ~IORING_SETUP_COOP_TASKRUN;
+                       goto retry;
+               }
                if (errno == EINVAL && p.flags & IORING_SETUP_CQSIZE) {
                        p.flags &= ~IORING_SETUP_CQSIZE;
                        goto retry;