summaryrefslogtreecommitdiff
path: root/fs/io_uring.c
diff options
context:
space:
mode:
authorPavel Begunkov <asml.silence@gmail.com>2021-09-15 12:04:20 +0100
committerJens Axboe <axboe@kernel.dk>2021-10-19 05:49:53 -0600
commita3f349071eb0ae2aa18ac2da55060865d8190cf0 (patch)
treebae7b570933a2771e24d30e398e500a635e7097c /fs/io_uring.c
parent83f84356bc8f2dda9d0c9c7edb94decf71a36d26 (diff)
downloadlwn-a3f349071eb0ae2aa18ac2da55060865d8190cf0.tar.gz
lwn-a3f349071eb0ae2aa18ac2da55060865d8190cf0.zip
io_uring: remove ctx referencing from complete_post
Now completions are done from task context, that means that it's either the task itself, task_work or io-wq worker. In all those cases the ctx will be staying alive by mutexing, explicit referencing or req references by iowq. Remove extra ctx pinning from io_req_complete_post(). Signed-off-by: Pavel Begunkov <asml.silence@gmail.com> Link: https://lore.kernel.org/r/60a0e96434c16ab4fe587651448290d61ec9a113.1631703756.git.asml.silence@gmail.com Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'fs/io_uring.c')
-rw-r--r--fs/io_uring.c10
1 files changed, 2 insertions, 8 deletions
diff --git a/fs/io_uring.c b/fs/io_uring.c
index 323ef0bb4bc1..027ca7a6df44 100644
--- a/fs/io_uring.c
+++ b/fs/io_uring.c
@@ -1809,17 +1809,11 @@ static void io_req_complete_post(struct io_kiocb *req, long res,
io_put_task(req->task, 1);
list_add(&req->inflight_entry, &ctx->locked_free_list);
ctx->locked_free_nr++;
- } else {
- if (!percpu_ref_tryget(&ctx->refs))
- req = NULL;
+ percpu_ref_put(&ctx->refs);
}
io_commit_cqring(ctx);
spin_unlock(&ctx->completion_lock);
-
- if (req) {
- io_cqring_ev_posted(ctx);
- percpu_ref_put(&ctx->refs);
- }
+ io_cqring_ev_posted(ctx);
}
static inline bool io_req_needs_clean(struct io_kiocb *req)