io_uring/wait.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
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
On 4/27/26 10:58 AM, Fiona Ebner wrote:
> 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>
Looks go to me! Just needs:
Cc: stable@vger.kernel.org
Fixes: 7b72d661f1f2 ("io_uring: gate iowait schedule on having pending requests")
tags added, I will do that. Thanks for debugging this and sending a fix.
--
Jens Axboe
Am 27.04.26 um 7:17 PM schrieb Jens Axboe:
> On 4/27/26 10:58 AM, Fiona Ebner wrote:
>> 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>
>
> Looks go to me! Just needs:
>
> Cc: stable@vger.kernel.org
> Fixes: 7b72d661f1f2 ("io_uring: gate iowait schedule on having pending requests")
>
> tags added, I will do that. Thanks for debugging this and sending a fix.
>
Thank you!
© 2016 - 2026 Red Hat, Inc.