public inbox for [email protected]
 help / color / mirror / Atom feed
From: Pavel Begunkov <[email protected]>
To: [email protected]
Cc: Jens Axboe <[email protected]>, [email protected]
Subject: [PATCH for-next 7/7] io_uring: remove iopoll spinlock
Date: Wed, 23 Nov 2022 11:33:42 +0000	[thread overview]
Message-ID: <7e171c8b530656b14a671c59100ca260e46e7f2a.1669203009.git.asml.silence@gmail.com> (raw)
In-Reply-To: <[email protected]>

This reverts commit 85f0e5da546bb215a27103ac8c698b8f60309ee0

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

Signed-off-by: Pavel Begunkov <[email protected]>
---
 io_uring/rw.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/io_uring/rw.c b/io_uring/rw.c
index 61c326831949..1ce065709724 100644
--- a/io_uring/rw.c
+++ b/io_uring/rw.c
@@ -1049,7 +1049,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);
@@ -1064,11 +1063,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);
-- 
2.38.1


  parent reply	other threads:[~2022-11-23 11:35 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-23 11:33 [PATCH for-next 0/7] iopoll cqe posting fixes Pavel Begunkov
2022-11-23 11:33 ` [PATCH for-next 1/7] io_uring: add completion locking for iopoll Pavel Begunkov
2022-11-23 11:33 ` [PATCH for-next 2/7] io_uring: hold locks for io_req_complete_failed Pavel Begunkov
2022-11-23 11:33 ` [PATCH for-next 3/7] io_uring: use io_req_task_complete() in timeout Pavel Begunkov
2022-11-23 11:33 ` [PATCH for-next 4/7] io_uring: remove io_req_tw_post_queue Pavel Begunkov
2022-11-23 11:33 ` [PATCH for-next 5/7] io_uring: inline __io_req_complete_put() Pavel Begunkov
2022-11-23 11:33 ` [PATCH for-next 6/7] io_uring: iopoll protect complete_post Pavel Begunkov
2022-11-23 11:33 ` Pavel Begunkov [this message]
2022-11-23 17:51 ` [PATCH for-next 0/7] iopoll cqe posting fixes Jens Axboe

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7e171c8b530656b14a671c59100ca260e46e7f2a.1669203009.git.asml.silence@gmail.com \
    [email protected] \
    [email protected] \
    [email protected] \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox