public inbox for [email protected]
 help / color / mirror / Atom feed
From: Dylan Yudaken <[email protected]>
To: "[email protected]" <[email protected]>,
	"[email protected]" <[email protected]>
Cc: "[email protected]" <[email protected]>
Subject: Re: [PATCH 1/2] io_uring/kbuf: fix not advancing READV kbuf ring
Date: Tue, 6 Sep 2022 17:22:33 +0000	[thread overview]
Message-ID: <[email protected]> (raw)
In-Reply-To: <a6d85e2611471bcb5d5dcd63a8342077ddc2d73d.1662480490.git.asml.silence@gmail.com>

On Tue, 2022-09-06 at 17:11 +0100, Pavel Begunkov wrote:
> When we don't recycle a selected ring buffer we should advance the
> head
> of the ring, so don't just skip io_kbuf_recycle() for IORING_OP_READV
> but adjust the ring.
> 
> Fixes: 934447a603b22 ("io_uring: do not recycle buffer in READV")
> Signed-off-by: Pavel Begunkov <[email protected]>
> ---
>  io_uring/kbuf.h | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/io_uring/kbuf.h b/io_uring/kbuf.h
> index d6af208d109f..746fbf31a703 100644
> --- a/io_uring/kbuf.h
> +++ b/io_uring/kbuf.h
> @@ -91,9 +91,13 @@ static inline void io_kbuf_recycle(struct io_kiocb
> *req, unsigned issue_flags)
>          * buffer data. However if that buffer is recycled the
> original request
>          * data stored in addr is lost. Therefore forbid recycling
> for now.
>          */
> -       if (req->opcode == IORING_OP_READV)
> +       if (req->opcode == IORING_OP_READV) {
> +               if ((req->flags & REQ_F_BUFFER_RING) && req-
> >buf_list) {
> +                       req->buf_list->head++;
> +                       req->buf_list = NULL;
> +               }
>                 return;
> -
> +       }
>         if (req->flags & REQ_F_BUFFER_SELECTED)
>                 io_kbuf_recycle_legacy(req, issue_flags);
>         if (req->flags & REQ_F_BUFFER_RING)


I do not know a good way to test this, but it reads to me likeit is
correct. It should probably be applied before the patch I sent earlier
today to remove this code so that backporting is easier.

Reviewed-by: Dylan Yudaken <[email protected]>


  reply	other threads:[~2022-09-06 17:30 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-06 16:11 [PATCH 0/2] ring buffer fixes Pavel Begunkov
2022-09-06 16:11 ` [PATCH 1/2] io_uring/kbuf: fix not advancing READV kbuf ring Pavel Begunkov
2022-09-06 17:22   ` Dylan Yudaken [this message]
2022-09-06 16:11 ` [PATCH 2/2] io_uring: recycle kbuf recycle on tw requeue Pavel Begunkov
2022-09-07 16:39 ` [PATCH 0/2] ring buffer fixes 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=8ba31b131b0f47e91417009472df962185dec681.camel@fb.com \
    [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