nvme: optimise io_uring passthrough completion
authorPavel Begunkov <asml.silence@gmail.com>
Mon, 15 May 2023 12:54:43 +0000 (13:54 +0100)
committerJens Axboe <axboe@kernel.dk>
Thu, 25 May 2023 14:54:06 +0000 (08:54 -0600)
Use IOU_F_TWQ_LAZY_WAKE via iou_cmd_exec_in_task_lazy() for passthrough
commands completion. It further delays the execution of task_work for
DEFER_TASKRUN until there are enough of task_work items queued to meet
the waiting criteria, which reduces the number of wake ups we issue.

Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
Link: https://lore.kernel.org/r/ecdfacd0967a22d88b7779e2efd09e040825d0f8.1684154817.git.asml.silence@gmail.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
drivers/nvme/host/ioctl.c

index 81c5c9e..52ed109 100644 (file)
@@ -521,7 +521,7 @@ static enum rq_end_io_ret nvme_uring_cmd_end_io(struct request *req,
        if (cookie != NULL && blk_rq_is_poll(req))
                nvme_uring_task_cb(ioucmd, IO_URING_F_UNLOCKED);
        else
-               io_uring_cmd_complete_in_task(ioucmd, nvme_uring_task_cb);
+               io_uring_cmd_do_in_task_lazy(ioucmd, nvme_uring_task_cb);
 
        return RQ_END_IO_FREE;
 }
@@ -543,7 +543,7 @@ static enum rq_end_io_ret nvme_uring_cmd_end_io_meta(struct request *req,
        if (cookie != NULL && blk_rq_is_poll(req))
                nvme_uring_task_meta_cb(ioucmd, IO_URING_F_UNLOCKED);
        else
-               io_uring_cmd_complete_in_task(ioucmd, nvme_uring_task_meta_cb);
+               io_uring_cmd_do_in_task_lazy(ioucmd, nvme_uring_task_meta_cb);
 
        return RQ_END_IO_NONE;
 }