From: Pavel Begunkov <[email protected]>
To: [email protected]
Cc: Jens Axboe <[email protected]>, [email protected]
Subject: [PATCH for-next 3/4] io_uring: ease timeout flush locking requirements
Date: Fri, 2 Dec 2022 17:47:24 +0000 [thread overview]
Message-ID: <1e3dc657975ac445b80e7bdc40050db783a5935a.1670002973.git.asml.silence@gmail.com> (raw)
In-Reply-To: <[email protected]>
We don't need completion_lock for timeout flushing, don't take it.
Signed-off-by: Pavel Begunkov <[email protected]>
---
io_uring/io_uring.c | 9 ++++-----
io_uring/timeout.c | 2 --
2 files changed, 4 insertions(+), 7 deletions(-)
diff --git a/io_uring/io_uring.c b/io_uring/io_uring.c
index 57c1c0da7648..4593016c6e37 100644
--- a/io_uring/io_uring.c
+++ b/io_uring/io_uring.c
@@ -570,12 +570,11 @@ static void io_eventfd_flush_signal(struct io_ring_ctx *ctx)
void __io_commit_cqring_flush(struct io_ring_ctx *ctx)
{
- if (ctx->off_timeout_used || ctx->drain_active) {
+ if (ctx->off_timeout_used)
+ io_flush_timeouts(ctx);
+ if (ctx->drain_active) {
spin_lock(&ctx->completion_lock);
- if (ctx->off_timeout_used)
- io_flush_timeouts(ctx);
- if (ctx->drain_active)
- io_queue_deferred(ctx);
+ io_queue_deferred(ctx);
spin_unlock(&ctx->completion_lock);
}
if (ctx->has_evfd)
diff --git a/io_uring/timeout.c b/io_uring/timeout.c
index eae005b2d1d2..826a51bca3e4 100644
--- a/io_uring/timeout.c
+++ b/io_uring/timeout.c
@@ -50,7 +50,6 @@ static inline void io_put_req(struct io_kiocb *req)
}
static bool io_kill_timeout(struct io_kiocb *req, int status)
- __must_hold(&req->ctx->completion_lock)
__must_hold(&req->ctx->timeout_lock)
{
struct io_timeout_data *io = req->async_data;
@@ -70,7 +69,6 @@ static bool io_kill_timeout(struct io_kiocb *req, int status)
}
__cold void io_flush_timeouts(struct io_ring_ctx *ctx)
- __must_hold(&ctx->completion_lock)
{
u32 seq;
struct io_timeout *timeout, *tmp;
--
2.38.1
next prev parent reply other threads:[~2022-12-02 17:48 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-12-02 17:47 [PATCH for-next 0/4] some 6.2 cleanups Pavel Begunkov
2022-12-02 17:47 ` [PATCH for-next 1/4] io_uring: protect cq_timeouts with timeout_lock Pavel Begunkov
2022-12-02 17:47 ` [PATCH for-next 2/4] io_uring: revise completion_lock locking Pavel Begunkov
2022-12-02 17:47 ` Pavel Begunkov [this message]
2022-12-02 17:47 ` [PATCH for-next 4/4] io_uring: rename __io_fill_cqe_req Pavel Begunkov
2022-12-02 20:03 ` [PATCH for-next 0/4] some 6.2 cleanups Jens Axboe
2022-12-14 16:06 ` 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=1e3dc657975ac445b80e7bdc40050db783a5935a.1670002973.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