On 5/17/23 08:23, Christoph Hellwig wrote:
On Mon, May 15, 2023 at 01:54:43PM +0100, Pavel Begunkov wrote:
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.
Why wouldn't you just do that unconditionally for
io_uring_cmd_complete_in_task?
1) ublk does secondary batching and so may produce multiple cqes,
that's not supported. I believe Ming sent patches removing it,
but I'd rather not deal with conflicts for now.
2) Some users may have dependencies b/w requests, i.e. a request
will only complete when another request's task_work is executed.
3) There might be use cases when you don't wont it to be delayed,
IO retries would be a good example. I wouldn't also use it for
control paths like ublk_ctrl_uring_cmd.
Let's better keep io_uring_cmd_complete_in_task() as the default
option for the interface.
--
Pavel Begunkov