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 -- Pavel Begunkov