From: Dylan Yudaken <[email protected]>
To: "[email protected]" <[email protected]>,
"[email protected]" <[email protected]>,
"[email protected]" <[email protected]>,
"[email protected]" <[email protected]>
Cc: Kernel Team <[email protected]>
Subject: Re: [PATCH for-next v3 4/7] io_uring: add IORING_SETUP_DEFER_TASKRUN
Date: Tue, 30 Aug 2022 13:34:41 +0000 [thread overview]
Message-ID: <[email protected]> (raw)
In-Reply-To: <[email protected]>
On Tue, 2022-08-30 at 21:19 +0800, Hao Xu wrote:
> On 8/19/22 20:19, Dylan Yudaken wrote:
> > Allow deferring async tasks until the user calls io_uring_enter(2)
> > with
> > the IORING_ENTER_GETEVENTS flag. Enable this mode with a flag at
> > io_uring_setup time. This functionality requires that the later
> > io_uring_enter will be called from the same submission task, and
> > therefore
> > restrict this flag to work only when IORING_SETUP_SINGLE_ISSUER is
> > also
> > set.
> >
> > Being able to hand pick when tasks are run prevents the problem
> > where
> > there is current work to be done, however task work runs anyway.
> >
> > For example, a common workload would obtain a batch of CQEs, and
> > process
> > each one. Interrupting this to additional taskwork would add
> > latency but
> > not gain anything. If instead task work is deferred to just before
> > more
> > CQEs are obtained then no additional latency is added.
> >
> > The way this is implemented is by trying to keep task work local to
> > a
> > io_ring_ctx, rather than to the submission task. This is required,
> > as the
> > application will want to wake up only a single io_ring_ctx at a
> > time to
> > process work, and so the lists of work have to be kept separate.
> >
> > This has some other benefits like not having to check the task
> > continually
> > in handle_tw_list (and potentially unlocking/locking those), and
> > reducing
> > locks in the submit & process completions path.
> >
> > There are networking cases where using this option can reduce
> > request
> > latency by 50%. For example a contrived example using [1] where the
> > client
> > sends 2k data and receives the same data back while doing some
> > system
> > calls (to trigger task work) shows this reduction. The reason ends
> > up
> > being that if sending responses is delayed by processing task work,
> > then
> > the client side sits idle. Whereas reordering the sends first means
> > that
> > the client runs it's workload in parallel with the local task work.
> >
>
> Sorry, seems I misunderstood the purpose of this patchset. Allow me
> to
> ask a question: "we always first submit sqes then handle task work
> (in IORING_SETUP_COOP_TASKRUN mode), how could the sending be
> interrupted by task works?"
IORING_SETUP_COOP_TASKRUN causes the task to not be interrupted simply
for task work, however it will still be run on every system call even
if completions are not about to be processed.
IoUring task work (unlike say epoll wakeups) can take a non-trivial
amount of time, and so running them closer to when they are used can
reduce latency of other unrelated operations by not unnecessarily
stalling them.
next prev parent reply other threads:[~2022-08-30 13:35 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-08-19 12:19 [PATCH for-next v3 0/7] io_uring: defer task work to when it is needed Dylan Yudaken
2022-08-19 12:19 ` [PATCH for-next v3 1/7] io_uring: remove unnecessary variable Dylan Yudaken
2022-08-19 12:19 ` [PATCH for-next v3 2/7] io_uring: introduce io_has_work Dylan Yudaken
2022-08-19 12:19 ` [PATCH for-next v3 3/7] io_uring: do not run task work at the start of io_uring_enter Dylan Yudaken
2022-08-19 12:19 ` [PATCH for-next v3 4/7] io_uring: add IORING_SETUP_DEFER_TASKRUN Dylan Yudaken
2022-08-22 11:34 ` Pavel Begunkov
2022-08-29 6:32 ` Hao Xu
2022-08-30 7:23 ` Dylan Yudaken
2022-08-30 7:54 ` Hao Xu
2022-08-30 9:54 ` Dylan Yudaken
2022-08-30 10:29 ` Pavel Begunkov
2022-08-30 13:19 ` Hao Xu
2022-08-30 13:34 ` Dylan Yudaken [this message]
2022-08-30 14:04 ` Hao Xu
2022-08-19 12:19 ` [PATCH for-next v3 5/7] io_uring: move io_eventfd_put Dylan Yudaken
2022-08-19 12:19 ` [PATCH for-next v3 6/7] io_uring: signal registered eventfd to process deferred task work Dylan Yudaken
2022-08-19 12:19 ` [PATCH for-next v3 7/7] io_uring: trace local task work run Dylan Yudaken
2022-08-29 7:01 ` [PATCH for-next v3 0/7] io_uring: defer task work to when it is needed Hao Xu
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=8ef2606d55d1097a17c24062fa64e39d43903755.camel@fb.com \
[email protected] \
[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