public inbox for io-uring@vger.kernel.org
 help / color / mirror / Atom feed
From: "Diangang Li" <lidiangang@bytedance.com>
To: "Jens Axboe" <axboe@kernel.dk>,
	"Fengnan Chang" <fengnanchang@gmail.com>,
	 <asml.silence@gmail.com>, <io-uring@vger.kernel.org>
Cc: "Fengnan Chang" <changfengnan@bytedance.com>
Subject: Re: [RFC PATCH 2/2] io_uring: fix io may accumulation in poll mode
Date: Mon, 15 Dec 2025 14:25:44 +0800	[thread overview]
Message-ID: <0ee133c7-d78d-45fc-afb2-0f398cb159ef@bytedance.com> (raw)
In-Reply-To: <95358f2c-d739-4dc1-b423-6ac3cbd96225@kernel.dk>

On 2025/12/13 04:09, Jens Axboe wrote:
> On 12/12/25 6:32 AM, Diangang Li wrote:
>>> @@ -1327,17 +1326,12 @@ int io_do_iopoll(struct io_ring_ctx *ctx, bool force_nonspin)
>>>    	if (ctx->poll_multi_queue || force_nonspin)
>>>    		poll_flags |= BLK_POLL_ONESHOT;
>>>    
>>> +	/*
>>> +	 * Loop over uncompleted polled IO requests, and poll for them.
>>> +	 */
>>>    	list_for_each_entry(req, &ctx->iopoll_list, iopoll_node) {
>>>    		int ret;
>>>    
>>> -		/*
>>> -		 * Move completed and retryable entries to our local lists.
>>> -		 * If we find a request that requires polling, break out
>>> -		 * and complete those lists first, if we have entries there.
>>> -		 */
>>> -		if (READ_ONCE(req->iopoll_completed))
>>> -			break;
>>
>> Suggest keeping iopoll_completed here to avoid unnecessary subsequent
>> polling and to process IRQ-completed requests promptly.
> 
> There should not be any IRQ completed requests in here. The block layer
> used to allow that, but that should no longer be the case. If it's a
> polled request, then it will by definition end up in a polled queue and
> need iopoll completion. Or it'll sit for a while and be completed by a
> timeout. If someone is still allowing polled IO with IRQ completions
> then that should be fixed, and there's no reason why we should try and
> catch those cases here. Will not happen with NVMe, for example.
> 

Hi Jens,

Before commit 958148a6ac06 ("block: check BLK_FEAT_POLL under 
q_usage_count"), if IORING_SETUP_IOPOLL was set, IO would still proceed 
even with zero poll queue. It would be redirected to default queues and 
still linked to ctx->iopoll_list. After that commit, these cases return 
BLK_STS_NOTSUPP.

While tests show the split path still exits: a split clears REQ_POLLED 
and sends the child to the default queue, yet the IO remains on 
iopoll_list. Is this the situation you’re referring to previously in our 
original patch with doubly-linked lists, that it's not necessarily safe 
to manipulating the list in io_complete_rw_iopoll?

> For the other point, there's no way for ->iopoll_completed to be set
> before iob.complete(&iob) has been called to invoke the callback, which
> in turn sets it. Hence there's no way for us to end up in this loop and
> have ->iopoll_completed set.
> 

Also, blk_mq_add_to_batch may return false for various reasons, so it's 
possible that the IO may complete earlier before we end up poll loop.

> So no, I don't think we need it, and honestly it wasn't even really
> needed the posted changes either.
> 



Best,
Diangang

  reply	other threads:[~2025-12-15  6:26 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-10  8:54 [RFC PATCH 0/2] io_uring: fix io may accumulation in poll mode Fengnan Chang
2025-12-10  8:55 ` [RFC PATCH 1/2] blk-mq: delete task running check in blk_hctx_poll Fengnan Chang
2025-12-10  9:19   ` Jens Axboe
2025-12-10  9:53   ` Jens Axboe
2025-12-10  8:55 ` [RFC PATCH 2/2] io_uring: fix io may accumulation in poll mode Fengnan Chang
2025-12-11  2:15   ` Jens Axboe
2025-12-11  4:10     ` Jens Axboe
2025-12-11  7:38       ` Fengnan
2025-12-11 10:22         ` Jens Axboe
2025-12-11 10:33           ` Jens Axboe
2025-12-11 11:13             ` Fengnan Chang
2025-12-11 11:19               ` Jens Axboe
2025-12-12  1:41             ` Fengnan Chang
2025-12-12  1:53               ` Jens Axboe
2025-12-12  2:12                 ` Fengnan Chang
2025-12-12  5:11                   ` Jens Axboe
2025-12-12  8:58                     ` Jens Axboe
2025-12-12  9:49                       ` Fengnan Chang
2025-12-12 20:22                         ` Jens Axboe
2025-12-12 13:32                     ` Diangang Li
2025-12-12 20:09                       ` Jens Axboe
2025-12-15  6:25                         ` Diangang Li [this message]
2025-12-17 12:34                     ` Diangang Li
2025-12-17 16:25                       ` Jens Axboe
2025-12-19  5:43                         ` Diangang Li
2025-12-10  9:53 ` (subset) [RFC PATCH 0/2] " 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=0ee133c7-d78d-45fc-afb2-0f398cb159ef@bytedance.com \
    --to=lidiangang@bytedance.com \
    --cc=asml.silence@gmail.com \
    --cc=axboe@kernel.dk \
    --cc=changfengnan@bytedance.com \
    --cc=fengnanchang@gmail.com \
    --cc=io-uring@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