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 07/11] io_uring: kill io_cq_unlock()
Date: Fri, 23 Jun 2023 12:23:27 +0100	[thread overview]
Message-ID: <7dabb36856db2b562e78780480396c52c29b2bf4.1687518903.git.asml.silence@gmail.com> (raw)
In-Reply-To: <[email protected]>

We're abusing ->completion_lock helpers. io_cq_unlock() neither
locking conditionally nor doing CQE flushing, which means that callers
must have some side reason of taking the lock and should do it directly.

Open code io_cq_unlock() into io_cqring_overflow_kill() and clean it up.

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

diff --git a/io_uring/io_uring.c b/io_uring/io_uring.c
index 776d1aa73d26..2f55abb676c0 100644
--- a/io_uring/io_uring.c
+++ b/io_uring/io_uring.c
@@ -644,12 +644,6 @@ static inline void io_cq_lock(struct io_ring_ctx *ctx)
 	spin_lock(&ctx->completion_lock);
 }
 
-static inline void io_cq_unlock(struct io_ring_ctx *ctx)
-	__releases(ctx->completion_lock)
-{
-	spin_unlock(&ctx->completion_lock);
-}
-
 /* keep it inlined for io_submit_flush_completions() */
 static inline void __io_cq_unlock_post(struct io_ring_ctx *ctx)
 	__releases(ctx->completion_lock)
@@ -694,10 +688,10 @@ static void io_cqring_overflow_kill(struct io_ring_ctx *ctx)
 	struct io_overflow_cqe *ocqe;
 	LIST_HEAD(list);
 
-	io_cq_lock(ctx);
+	spin_lock(&ctx->completion_lock);
 	list_splice_init(&ctx->cq_overflow_list, &list);
 	clear_bit(IO_CHECK_CQ_OVERFLOW_BIT, &ctx->check_cq);
-	io_cq_unlock(ctx);
+	spin_unlock(&ctx->completion_lock);
 
 	while (!list_empty(&list)) {
 		ocqe = list_first_entry(&list, struct io_overflow_cqe, list);
-- 
2.40.0


  parent reply	other threads:[~2023-06-23 11:24 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-23 11:23 [PATCH 00/11] clean up req free and CQ locking Pavel Begunkov
2023-06-23 11:23 ` [PATCH 01/11] io_uring: open code io_put_req_find_next Pavel Begunkov
2023-06-23 11:23 ` [PATCH 02/11] io_uring: remove io_free_req_tw Pavel Begunkov
2023-06-23 11:23 ` [PATCH 03/11] io_uring: inline io_dismantle_req() Pavel Begunkov
2023-06-23 11:23 ` [PATCH 04/11] io_uring: move io_clean_op() Pavel Begunkov
2023-06-23 11:23 ` [PATCH 05/11] io_uring: don't batch task put on reqs free Pavel Begunkov
2023-06-23 11:23 ` [PATCH 06/11] io_uring: remove IOU_F_TWQ_FORCE_NORMAL Pavel Begunkov
2023-06-23 11:23 ` Pavel Begunkov [this message]
2023-06-23 11:23 ` [PATCH 08/11] io_uring: fix acquire/release annotations Pavel Begunkov
2023-06-23 11:23 ` [PATCH 09/11] io_uring: inline __io_cq_unlock Pavel Begunkov
2023-06-23 11:23 ` [PATCH 10/11] io_uring: make io_cq_unlock_post static Pavel Begunkov
2023-06-23 11:23 ` [PATCH 11/11] io_uring: merge conditional unlock flush helpers Pavel Begunkov
2023-06-23 14:26 ` [PATCH 00/11] clean up req free and CQ locking Jens Axboe
2023-06-23 14:27 ` 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=7dabb36856db2b562e78780480396c52c29b2bf4.1687518903.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