Skip to content

Commit

Permalink
io_uring: remove iopoll spinlock
Browse files Browse the repository at this point in the history
commit 2dac1a1 upstream.

This reverts commit 2ccc92f

io_req_complete_post() should now behave well even in case of IOPOLL, we
can remove completion_lock locking.

Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
Link: https://lore.kernel.org/r/7e171c8b530656b14a671c59100ca260e46e7f2a.1669203009.git.asml.silence@gmail.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
isilence authored and gregkh committed Dec 31, 2022
1 parent 9b5d3f2 commit 69c2ad9
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions io_uring/rw.c
Original file line number Diff line number Diff line change
Expand Up @@ -1043,7 +1043,6 @@ int io_do_iopoll(struct io_ring_ctx *ctx, bool force_nonspin)
else if (!pos)
return 0;

spin_lock(&ctx->completion_lock);
prev = start;
wq_list_for_each_resume(pos, prev) {
struct io_kiocb *req = container_of(pos, struct io_kiocb, comp_list);
Expand All @@ -1058,11 +1057,11 @@ int io_do_iopoll(struct io_ring_ctx *ctx, bool force_nonspin)
req->cqe.flags = io_put_kbuf(req, 0);
__io_fill_cqe_req(req->ctx, req);
}
io_commit_cqring(ctx);
spin_unlock(&ctx->completion_lock);

if (unlikely(!nr_events))
return 0;

io_commit_cqring(ctx);
io_cqring_ev_posted_iopoll(ctx);
pos = start ? start->next : ctx->iopoll_list.first;
wq_list_cut(&ctx->iopoll_list, prev, start);
Expand Down

0 comments on commit 69c2ad9

Please sign in to comment.