All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jens Axboe <axboe@kernel.dk>
To: Pavel Begunkov <asml.silence@gmail.com>, io-uring@vger.kernel.org
Subject: Re: [PATCH 3/4] io_uring: tweak iopoll return for REQ_F_CQE_SKIP
Date: Sat, 4 Dec 2021 15:21:20 -0700	[thread overview]
Message-ID: <797fbd8a-ea46-091d-0d26-0103026295f2@kernel.dk> (raw)
In-Reply-To: <416acc6e18b03bf41009e5ae3765737201e7c87c.1638650836.git.asml.silence@gmail.com>

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 <asml.silence@gmail.com>
> ---
>  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.

-- 
Jens Axboe


  reply	other threads:[~2021-12-04 22:21 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 [this message]
2021-12-04 22:48     ` Pavel Begunkov
2021-12-04 23:20       ` Jens Axboe
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 \
    --in-reply-to=797fbd8a-ea46-091d-0d26-0103026295f2@kernel.dk \
    --to=axboe@kernel.dk \
    --cc=asml.silence@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.