public inbox for [email protected]
 help / color / mirror / Atom feed
From: Jens Axboe <[email protected]>
To: Pavel Begunkov <[email protected]>, [email protected]
Subject: Re: [PATCH 3/4] io_uring: tweak iopoll return for REQ_F_CQE_SKIP
Date: Sat, 4 Dec 2021 16:20:01 -0700	[thread overview]
Message-ID: <[email protected]> (raw)
In-Reply-To: <[email protected]>

On 12/4/21 3:48 PM, Pavel Begunkov wrote:
> On 12/4/21 22:21, Jens Axboe wrote:
>> On 12/4/21 1:49 PM, Pavel Begunkov wrote:
>>> Currently, IOPOLL returns the number of completed requests, but with
>>> REQ_F_CQE_SKIP there are not the same thing anymore. That may be
>>> confusing as non-iopoll wait cares only about CQEs, so make io_do_iopoll
>>> return the number of posted CQEs.
>>>
>>> Signed-off-by: Pavel Begunkov <[email protected]>
>>> ---
>>>   fs/io_uring.c | 6 +++---
>>>   1 file changed, 3 insertions(+), 3 deletions(-)
>>>
>>> diff --git a/fs/io_uring.c b/fs/io_uring.c
>>> index 64add8260abb..ea7a0daa0b3b 100644
>>> --- a/fs/io_uring.c
>>> +++ b/fs/io_uring.c
>>> @@ -2538,10 +2538,10 @@ static int io_do_iopoll(struct io_ring_ctx *ctx, bool force_nonspin)
>>>   		/* order with io_complete_rw_iopoll(), e.g. ->result updates */
>>>   		if (!smp_load_acquire(&req->iopoll_completed))
>>>   			break;
>>> +		if (unlikely(req->flags & REQ_F_CQE_SKIP))
>>> +			continue;
>>>   
>>> -		if (!(req->flags & REQ_F_CQE_SKIP))
>>> -			__io_fill_cqe(ctx, req->user_data, req->result,
>>> -				      io_put_kbuf(req));
>>> +		__io_fill_cqe(ctx, req->user_data, req->result, io_put_kbuf(req));
>>>   		nr_events++;
>>>   	}
>>>   
>>
>> Not sure I follow the logic behind this change. Places like
>> io_iopoll_try_reap_events() just need a "did we find anything" return,
>> which is independent on whether or not we actually posted CQEs or not.
>> Other callers either don't care what the return value is or if it's < 0
>> or not (which this change won't affect).
>>
>> I feel like I'm missing something here, or that the commit message
>> better needs to explain why this change is done.
> 
> I was wrong on how I described it, but it means that the problem is in
> a different place.
> 
> int io_do_iopoll() {
> 	return nr_events;
> }
> 
> int io_iopoll_check() {
> 	do {
> 		nr_events += io_do_iopoll();
> 	while (nr_events < min && ...);
> }
> 
> And "events" there better to be CQEs, otherwise the semantics
> of @min + CQE_SKIP is not very clear and mismatches non-IOPOLL.

Can you do a v2 of this patch? Rest of them look good to me.

-- 
Jens Axboe


  reply	other threads:[~2021-12-04 23:20 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-04 20:49 [PATCH 0/4] small 5.17 updates Pavel Begunkov
2021-12-04 20:49 ` [PATCH 1/4] io_uring: move up io_put_kbuf() and io_put_rw_kbuf() Pavel Begunkov
2021-12-04 20:49 ` [PATCH 2/4] io_uring: simplify selected buf handling Pavel Begunkov
2021-12-04 20:49 ` [PATCH 3/4] io_uring: tweak iopoll return for REQ_F_CQE_SKIP Pavel Begunkov
2021-12-04 22:21   ` Jens Axboe
2021-12-04 22:48     ` Pavel Begunkov
2021-12-04 23:20       ` Jens Axboe [this message]
2021-12-05  0:23         ` Pavel Begunkov
2021-12-04 20:49 ` [PATCH 4/4] io_uring: reuse io_req_task_complete for timeouts Pavel Begunkov

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 \
    [email protected] \
    [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