io_uring: save ctx put/get for task_work submit
authorPavel Begunkov <asml.silence@gmail.com>
Fri, 12 Feb 2021 03:23:54 +0000 (03:23 +0000)
committerJens Axboe <axboe@kernel.dk>
Fri, 12 Feb 2021 12:30:25 +0000 (05:30 -0700)
commit04fc6c802dfacba800f5a5d00bea0ebfcc60f840
tree4a4ee9b5924d069c1c4d9f64b24ed9634058be1b
parent921b9054e0c4c443c479c21800f6c4c8b43fa1b0
io_uring: save ctx put/get for task_work submit

Do a little trick in io_ring_ctx_free() briefly taking uring_lock, that
will wait for everyone currently holding it, so we can skip pinning ctx
with ctx->refs for __io_req_task_submit(), which is executed and loses
its refs/reqs while holding the lock.

Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
fs/io_uring.c