Commit fb682099 authored by Pavel Begunkov's avatar Pavel Begunkov Committed by Jens Axboe

io_uring: optimise initial ltimeout refcounting

Linked timeouts are never refcounted when it comes to the first call to
__io_prep_linked_timeout(), so save an io_ref_get() and set the desired
value directly.
Signed-off-by: default avatarPavel Begunkov <asml.silence@gmail.com>
Link: https://lore.kernel.org/r/177b24cc62ffbb42d915d6eb9e8876266e4c0d5a.1628981736.git.asml.silence@gmail.comSigned-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent 761bcac1
...@@ -1312,8 +1312,7 @@ static struct io_kiocb *__io_prep_linked_timeout(struct io_kiocb *req) ...@@ -1312,8 +1312,7 @@ static struct io_kiocb *__io_prep_linked_timeout(struct io_kiocb *req)
/* linked timeouts should have two refs once prep'ed */ /* linked timeouts should have two refs once prep'ed */
io_req_set_refcount(req); io_req_set_refcount(req);
io_req_set_refcount(nxt); __io_req_set_refcount(nxt, 2);
req_ref_get(nxt);
nxt->timeout.head = req; nxt->timeout.head = req;
nxt->flags |= REQ_F_LTIMEOUT_ACTIVE; nxt->flags |= REQ_F_LTIMEOUT_ACTIVE;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment