From: Pavel Begunkov <[email protected]>
To: [email protected]
Cc: Jens Axboe <[email protected]>, [email protected]
Subject: Re: [PATCH for-next 2/2] io_uring: optimise ltimeout for inline execution
Date: Fri, 1 Dec 2023 19:03:34 +0000 [thread overview]
Message-ID: <[email protected]> (raw)
In-Reply-To: <8bf69c2a4beec14c565c85c86edb871ca8b8bcc8.1701390926.git.asml.silence@gmail.com>
On 12/1/23 00:38, Pavel Begunkov wrote:
> At one point in time we had an optimisation that would not spin up a
> linked timeout timer when the master request successfully completes
> inline (during the first nowait execution attempt). We somehow lost it,
> so this patch restores it back.
>
> Note, that it's fine using io_arm_ltimeout() after the io_issue_sqe()
> completes the request because of delayed completion, but that that adds
> unwanted overhead.
Let's add:
Reported-by: Christian Mazakas <[email protected]>
>
> Signed-off-by: Pavel Begunkov <[email protected]>
> ---
> io_uring/io_uring.c | 19 +++++++++----------
> 1 file changed, 9 insertions(+), 10 deletions(-)
>
> diff --git a/io_uring/io_uring.c b/io_uring/io_uring.c
> index 21e646ef9654..6212f81ed887 100644
> --- a/io_uring/io_uring.c
> +++ b/io_uring/io_uring.c
> @@ -1900,14 +1900,15 @@ static int io_issue_sqe(struct io_kiocb *req, unsigned int issue_flags)
> return 0;
> }
>
> - if (ret != IOU_ISSUE_SKIP_COMPLETE)
> - return ret;
> -
> - /* If the op doesn't have a file, we're not polling for it */
> - if ((req->ctx->flags & IORING_SETUP_IOPOLL) && def->iopoll_queue)
> - io_iopoll_req_issued(req, issue_flags);
> + if (ret == IOU_ISSUE_SKIP_COMPLETE) {
> + ret = 0;
> + io_arm_ltimeout(req);
>
> - return 0;
> + /* If the op doesn't have a file, we're not polling for it */
> + if ((req->ctx->flags & IORING_SETUP_IOPOLL) && def->iopoll_queue)
> + io_iopoll_req_issued(req, issue_flags);
> + }
> + return ret;
> }
>
> int io_poll_issue(struct io_kiocb *req, struct io_tw_state *ts)
> @@ -2078,9 +2079,7 @@ static inline void io_queue_sqe(struct io_kiocb *req)
> * We async punt it if the file wasn't marked NOWAIT, or if the file
> * doesn't support non-blocking read/write attempts
> */
> - if (likely(!ret))
> - io_arm_ltimeout(req);
> - else
> + if (unlikely(ret))
> io_queue_async(req, ret);
> }
>
--
Pavel Begunkov
next prev parent reply other threads:[~2023-12-01 19:04 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-12-01 0:38 [PATCH for-next 0/2] inline execution ltimeout optimisation Pavel Begunkov
2023-12-01 0:38 ` [PATCH for-next 1/2] io_uring: don't check iopoll if request completes Pavel Begunkov
2023-12-01 0:38 ` [PATCH for-next 2/2] io_uring: optimise ltimeout for inline execution Pavel Begunkov
2023-12-01 19:03 ` Pavel Begunkov [this message]
2023-12-03 15:22 ` [PATCH for-next 0/2] inline execution ltimeout optimisation 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 \
[email protected] \
[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