On 2022/10/23 17:38, Ming Lei wrote: > task_work_add() is used for waking ubq daemon task with one batch > of io requests/commands queued. However, task_work_add() isn't > exported for module code, and it is still debatable if the symbol > should be exported. > > Fortunately we still have io_uring_cmd_complete_in_task() which just > can't handle batched wakeup for us. > > Add one one llist into ublk_queue and call io_uring_cmd_complete_in_task() > via current command for running them via task work. > > This way cleans up current code a lot, meantime allow us to wakeup > ubq daemon task after queueing batched requests/io commands. > Hi, Ming This patch works and I have run some tests to compare current version(ucmd) with your patch(ucmd-batch). iodepth=128 numjobs=1 direct=1 bs=4k -------------------------------------------- ublk loop target, the backend is a file. IOPS(k) type ucmd ucmd-batch seq-read 54.7 54.2 rand-read 52.8 52.0 -------------------------------------------- ublk null target IOPS(k) type ucmd ucmd-batch seq-read 257 257 rand-read 252 253 I find that io_req_task_work_add() puts task_work node into a llist first, then it may call task_work_add() to run batched task_works. So do we really need such llist in ublk_drv? I think io_uring has already considered task_work batch optimization. BTW, task_work_add() in ublk_drv achieves higher IOPS(about 5-10% on my machine) than io_uring_cmd_complete_in_task() in ublk_drv. Regards, Zhang