提交 14bacbdd 编写于 作者: J Jens Axboe 提交者: Joseph Qi

io_uring: pick up link work on submit reference drop

to #26323588

commit 2a44f46781617c5040372b59da33553a02b1f46d upstream.

If work completes inline, then we should pick up a dependent link item
in __io_queue_sqe() as well. If we don't do so, we're forced to go async
with that item, which is suboptimal.

This also fixes an issue with io_put_req_find_next(), which always looks
up the next work item. That should only be done if we're dropping the
last reference to the request, to prevent multiple lookups of the same
work item.

Outside of being a fix, this also enables a good cleanup series for 5.7,
where we never have to pass 'nxt' around or into the work handlers.
Reviewed-by: NPavel Begunkov <asml.silence@gmail.com>
Signed-off-by: NJens Axboe <axboe@kernel.dk>
Signed-off-by: NJoseph Qi <joseph.qi@linux.alibaba.com>
Acked-by: NXiaoguang Wang <xiaoguang.wang@linux.alibaba.com>
上级 8f17fa5a
...@@ -1483,10 +1483,10 @@ static void io_free_req(struct io_kiocb *req) ...@@ -1483,10 +1483,10 @@ static void io_free_req(struct io_kiocb *req)
__attribute__((nonnull)) __attribute__((nonnull))
static void io_put_req_find_next(struct io_kiocb *req, struct io_kiocb **nxtptr) static void io_put_req_find_next(struct io_kiocb *req, struct io_kiocb **nxtptr)
{ {
io_req_find_next(req, nxtptr); if (refcount_dec_and_test(&req->refs)) {
io_req_find_next(req, nxtptr);
if (refcount_dec_and_test(&req->refs))
__io_free_req(req); __io_free_req(req);
}
} }
static void io_put_req(struct io_kiocb *req) static void io_put_req(struct io_kiocb *req)
...@@ -4751,7 +4751,7 @@ static void __io_queue_sqe(struct io_kiocb *req, const struct io_uring_sqe *sqe) ...@@ -4751,7 +4751,7 @@ static void __io_queue_sqe(struct io_kiocb *req, const struct io_uring_sqe *sqe)
err: err:
/* drop submission reference */ /* drop submission reference */
io_put_req(req); io_put_req_find_next(req, &nxt);
if (linked_timeout) { if (linked_timeout) {
if (!ret) if (!ret)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册