On 11/4/24 16:16, Jens Axboe wrote:
On 11/4/24 8:41 AM, Pavel Begunkov wrote:
On 11/3/24 17:49, Jens Axboe wrote:
Rather than store the task_struct itself in struct io_kiocb, store
the io_uring specific task_struct. The life times are the same in terms
of io_uring, and this avoids doing some dereferences through the
task_struct. For the hot path of putting local task references, we can
Makes me wonder, is __io_submit_flush_completions() the only hot
place it tries to improve? It doesn't have to look into the task
there but on the other hand we need to do it that init.
If that's costly, for DEFER_TASKRUN we can get rid of per task
counting, the task is pinned together with the ctx, and the task
exit path can count the number of requests allocated.
if (!(ctx->flags & DEFER_TASKRUN))
io_task_get_ref();
if (!(ctx->flags & DEFER_TASKRUN))
io_task_put_ref();
But can be further improved
Avoid task refs would surely be useful. For SINGLE_ISSUER, no?
Perhaps, but it doesn't imply single waiter / completer task.
IOPOLL would need to be checked and possibly there might be
races with io-wq. In general, all optimisations just got
shifted into DEFER_TASKRUN and SINGLE_ISSUER is not that useful
apart from carrying the semantics.
--
Pavel Begunkov