All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCHSET v3 0/3] Add support for registered waits
@ 2024-10-25 14:12 Jens Axboe
  2024-10-25 14:12 ` [PATCH 1/3] io_uring: switch struct ext_arg from __kernel_timespec to timespec64 Jens Axboe
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Jens Axboe @ 2024-10-25 14:12 UTC (permalink / raw)
  To: io-uring

Hi,

v3 of the registered wait support, avoiding needless copies for doing
high frequency waits. For v1, see the posting here:

https://lore.kernel.org/io-uring/20241022204708.1025470-1-axboe@kernel.dk/T/#m2d1eb2cc648b9f9c292fd75fc6bc2a8d71eadd49

As with v1, find the kernel repo here:

https://git.kernel.dk/cgit/linux/log/?h=io_uring-reg-wait

and the liburing side here:

https://git.kernel.dk/cgit/liburing/log/?h=reg-wait

 include/linux/io_uring_types.h |  10 ++++
 include/uapi/linux/io_uring.h  |  41 +++++++++++++
 io_uring/io_uring.c            | 105 ++++++++++++++++++++++++++-------
 io_uring/register.c            |  82 +++++++++++++++++++++++++
 io_uring/register.h            |   1 +
 5 files changed, 217 insertions(+), 22 deletions(-)

Since v2:
- Wrap registration with a setup struct, to better future proof the
  feature. That would allow doing a registered wait variant with the
  sigmask embedded as well, should that be interesting in the future.
- Update liburing reg-wait branch with the new registration API
- Fixup copy for 32 vs 64-bit
- Minor cleanups and comments

-- 
Jens Axboe


^ permalink raw reply	[flat|nested] 6+ messages in thread
* [PATCHSET v2 0/3] Add support for registered waits
@ 2024-10-23 15:54 Jens Axboe
  2024-10-23 15:54 ` [PATCH 3/3] io_uring: add support for fixed wait regions Jens Axboe
  0 siblings, 1 reply; 6+ messages in thread
From: Jens Axboe @ 2024-10-23 15:54 UTC (permalink / raw)
  To: io-uring

Hi,

v2 of the registered wait support, avoiding needless copies for doing
high frequency waits. For v1, see the posting here:

https://lore.kernel.org/io-uring/20241022204708.1025470-1-axboe@kernel.dk/T/#m2d1eb2cc648b9f9c292fd75fc6bc2a8d71eadd49

As with v1, find the kernel repo here:

https://git.kernel.dk/cgit/linux/log/?h=io_uring-reg-wait

and the liburing side here:

https://git.kernel.dk/cgit/liburing/log/?h=reg-wait

 include/linux/io_uring_types.h |  10 ++++
 include/uapi/linux/io_uring.h  |  18 ++++++
 io_uring/io_uring.c            | 104 ++++++++++++++++++++++++++-------
 io_uring/register.c            |  79 +++++++++++++++++++++++++
 io_uring/register.h            |   1 +
 5 files changed, 190 insertions(+), 22 deletions(-)

Since v1:
- Add io_unregister_cqwait_reg() for ring exit cleanp
- Ensure some 32-bit archs work with uaccess
- Add separate index for checking validity of wait index
- Add various sanity checking for registration
- Account memory for cqwait region
- Expand the test cases in liburing quite a bit

-- 
Jens Axboe


^ permalink raw reply	[flat|nested] 6+ messages in thread
* [PATCHSET RFC 0/3] Add support for registered waits
@ 2024-10-22 20:39 Jens Axboe
  2024-10-22 20:39 ` [PATCH 3/3] io_uring: add support for fixed wait regions Jens Axboe
  0 siblings, 1 reply; 6+ messages in thread
From: Jens Axboe @ 2024-10-22 20:39 UTC (permalink / raw)
  To: io-uring

Hi,

While doing testing on zero-copy tx/rx with io_uring, I noticed that a
LOT of time is being spent copying in data structures related to waiting
on events. While the structures aren't big (24b and 16b), it's a user
copy, and a dependent user copy on top of that - first get the main
struct io_uring_getevents_arg, and then copy in the timeout from that.
Details are in patch 3 on the numbers.

I then toyed around with the idea of having registered regions of wait
data. This can be set by the application, and then directly seen by the
kernel. On top of that, embed the timeout itself in this region, rather
than it being supplied as an out-of-band pointer.

Patch 1 is just a generic cleanup, and patch 2 improves the copying a
both. Both of these can stand alone. Patch 3 implements the meat of this,
which adds IORING_REGISTER_CQWAIT_REG, allowing an application to
register a number of struct io_uring_reg_wait regions that it can index
for wait scenarios. The kernel always registers a full page, so on 4k
page size archs, 64 regions are available by default. Then rather than
pass in a pointer to a struct io_uring_getevents_arg, an index is passed
instead, telling the kernel which registered wait region should be used
for this wait.

This basically removes all of the copying seen, which was anywhere from
3.5-4.5% of the time, when doing high frequency operations where
the number of wait invocations can be quite high.

Patches sit on top of the io_uring-ring-resize branch, as both end up
adding register opcodes.

Kernel branch here:

https://git.kernel.dk/cgit/linux/log/?h=io_uring-reg-wait

and liburing (pretty basic right now) branch here:

https://git.kernel.dk/cgit/liburing/log/?h=reg-wait

 include/linux/io_uring_types.h |   7 +++
 include/uapi/linux/io_uring.h  |  18 ++++++
 io_uring/io_uring.c            | 102 ++++++++++++++++++++++++++-------
 io_uring/register.c            |  48 ++++++++++++++++
 4 files changed, 153 insertions(+), 22 deletions(-)

-- 
Jens Axboe


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2024-10-25 14:14 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-25 14:12 [PATCHSET v3 0/3] Add support for registered waits Jens Axboe
2024-10-25 14:12 ` [PATCH 1/3] io_uring: switch struct ext_arg from __kernel_timespec to timespec64 Jens Axboe
2024-10-25 14:12 ` [PATCH 2/3] io_uring: change io_get_ext_arg() to use uaccess begin + end Jens Axboe
2024-10-25 14:13 ` [PATCH 3/3] io_uring: add support for fixed wait regions Jens Axboe
  -- strict thread matches above, loose matches on Subject: below --
2024-10-23 15:54 [PATCHSET v2 0/3] Add support for registered waits Jens Axboe
2024-10-23 15:54 ` [PATCH 3/3] io_uring: add support for fixed wait regions Jens Axboe
2024-10-22 20:39 [PATCHSET RFC 0/3] Add support for registered waits Jens Axboe
2024-10-22 20:39 ` [PATCH 3/3] io_uring: add support for fixed wait regions Jens Axboe

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.