From: Fiona Ebner <f.ebner@proxmox.com>
To: io-uring@vger.kernel.org
Cc: axboe@kernel.dk, linux-kernel@vger.kernel.org, t.lamprecht@proxmox.com
Subject: [PATCH] io_uring/wait: make check for pending io consider cached task references
Date: Mon, 27 Apr 2026 18:58:49 +0200 [thread overview]
Message-ID: <20260427165910.683941-1-f.ebner@proxmox.com> (raw)
The io_uring task's inflight count also includes the reservations for
task references from io_task_refs_refill(), not just in-flight
requests. Thus, pending requests are present if the inflight count is
larger than the number of cached references.
Co-developed-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
---
io_uring/wait.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/io_uring/wait.c b/io_uring/wait.c
index 91df86ce0d18c..d9d4fe3b0f40c 100644
--- a/io_uring/wait.c
+++ b/io_uring/wait.c
@@ -48,7 +48,13 @@ static bool current_pending_io(void)
if (!tctx)
return false;
- return percpu_counter_read_positive(&tctx->inflight);
+ /*
+ * tctx->inflight also includes the reservations for task references
+ * from io_task_refs_refill(), not just in-flight requests. Thus,
+ * pending requests are present if the inflight count is larger than the
+ * number of cached references.
+ */
+ return percpu_counter_read_positive(&tctx->inflight) > tctx->cached_refs;
}
static enum hrtimer_restart io_cqring_timer_wakeup(struct hrtimer *timer)
--
2.47.3
next reply other threads:[~2026-04-27 16:59 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-27 16:58 Fiona Ebner [this message]
2026-04-27 17:18 ` [PATCH] io_uring/wait: make check for pending io consider cached task references Jens Axboe
2026-04-28 9:54 ` Fiona Ebner
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=20260427165910.683941-1-f.ebner@proxmox.com \
--to=f.ebner@proxmox.com \
--cc=axboe@kernel.dk \
--cc=io-uring@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=t.lamprecht@proxmox.com \
/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