Hi,
在 2021/12/8 上午5:16, Pavel Begunkov 写道:
On 12/7/21 21:01, Pavel Begunkov wrote:
On 12/7/21 09:39, Hao Xu wrote:
In previous patches, we have already gathered some tw with
io_req_task_complete() as callback in prior_task_list, let's complete
them in batch while we cannot grab uring lock. In this way, we batch
the req_complete_post path.
[...]
+ if (likely(*uring_locked))
+ req->io_task_work.func(req, uring_locked);
+ else
+ __io_req_complete_post(req, req->result,
io_put_kbuf(req));
I think there is the same issue as last time, first iteration of
tctx_task_work()
sets ctx but doesn't get uring_lock. Then you go here, find a request
with the
same ctx and end up here with locking.
Maybe something like below on top? Totally untested. We basically always
want *uring_locked != *compl_locked, so we don't even need to to store
both vars.
Thanks, Pavel. I Forgot to think about when req->ctx == ctx, tested the
fix here
and it looks good.
Regards,
Hao