From: Sasha Levin <sashal@kernel.org>
To: stable@vger.kernel.org
Cc: Caleb Sander Mateos <csander@purestorage.com>,
Jens Axboe <axboe@kernel.dk>, Sasha Levin <sashal@kernel.org>
Subject: [PATCH 6.18.y 3/6] io_uring: only call io_should_terminate_tw() once for ctx
Date: Wed, 9 Sep 2026 11:09:42 -0400 [thread overview]
Message-ID: <20260909150945.2815896-3-sashal@kernel.org> (raw)
In-Reply-To: <20260909150945.2815896-1-sashal@kernel.org>
From: Caleb Sander Mateos <csander@purestorage.com>
[ Upstream commit 4531d165ee39edb315b42a4a43e29339fa068e51 ]
io_fallback_req_func() calls io_should_terminate_tw() on each req's ctx.
But since the reqs all come from the ctx's fallback_llist, req->ctx will
be ctx for all of the reqs. Therefore, compute ts.cancel as
io_should_terminate_tw(ctx) just once, outside the loop.
Signed-off-by: Caleb Sander Mateos <csander@purestorage.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Stable-dep-of: 2cf20c4e0f72 ("io_uring/waitid: avoid siginfo copy during ring teardown")
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
io_uring/io_uring.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/io_uring/io_uring.c b/io_uring/io_uring.c
index d59a750e5e89c..7c0ef8f04139c 100644
--- a/io_uring/io_uring.c
+++ b/io_uring/io_uring.c
@@ -292,10 +292,9 @@ static __cold void io_fallback_req_func(struct work_struct *work)
percpu_ref_get(&ctx->refs);
mutex_lock(&ctx->uring_lock);
- llist_for_each_entry_safe(req, tmp, node, io_task_work.node) {
- ts.cancel = io_should_terminate_tw(req->ctx);
+ ts.cancel = io_should_terminate_tw(ctx);
+ llist_for_each_entry_safe(req, tmp, node, io_task_work.node)
req->io_task_work.func(req, ts);
- }
io_submit_flush_completions(ctx);
mutex_unlock(&ctx->uring_lock);
percpu_ref_put(&ctx->refs);
--
2.53.0
next prev parent reply other threads:[~2026-09-09 15:09 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-03 14:52 FAILED: patch "[PATCH] io_uring/waitid: avoid siginfo copy during ring teardown" failed to apply to 6.18-stable tree gregkh
2026-09-09 15:09 ` [PATCH 6.18.y 1/6] io_uring: unify task_work cancelation checks Sasha Levin
2026-09-09 15:09 ` [PATCH 6.18.y 2/6] io_uring/waitid: have io_waitid_complete() remove wait queue entry Sasha Levin
2026-09-09 15:09 ` Sasha Levin [this message]
2026-09-09 15:09 ` [PATCH 6.18.y 4/6] io_uring: add wrapper type for io_req_tw_func_t arg Sasha Levin
2026-09-09 15:09 ` [PATCH 6.18.y 5/6] io_uring/waitid: honor task_work cancellation Sasha Levin
2026-09-09 15:09 ` [PATCH 6.18.y 6/6] io_uring/waitid: avoid siginfo copy during ring teardown Sasha Levin
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=20260909150945.2815896-3-sashal@kernel.org \
--to=sashal@kernel.org \
--cc=axboe@kernel.dk \
--cc=csander@purestorage.com \
--cc=stable@vger.kernel.org \
/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