mbox series

[RFC,0/4] pre-mapped rw attributes

Message ID cover.1735301337.git.asml.silence@gmail.com (mailing list archive)
Headers show
Series pre-mapped rw attributes | expand

Message

Pavel Begunkov Dec. 30, 2024, 1:30 p.m. UTC
warning: not properly tested

Follow up on the discussion about optimising copy_from_user() for
read/write attributes. The idea here is to use registered regions
(see IORING_REGISTER_MEM_REGION) for that purpose pretty much in
the same way registered wait arguments work.

Putting it simply, a region is a user provided chunk of memory
that has been registered and pre-mapped into io_uring / kernel,
but it has more modes like mmap'ing kernel memory. For attributes
the user passes an offset into a region, and the kernel can read
from it directly without copy_from_user().

The other alternative is to store attributes into the upper half
of SQE128, but then we might run out of space in SQE for larger
and/or compound attributes. It'd also require SQE128, which has a
(perhaps minor) downside when other types of requests don't need it.

Pavel Begunkov (4):
  io_uring: add structure for registered arguments
  io_uring: add registered request arguments
  io_uring/rw: use READ_ONCE with rw attributes
  io_uring/rw: pre-mapped rw attributes

 include/linux/io_uring_types.h | 11 ++++++++--
 include/uapi/linux/io_uring.h  |  4 +++-
 io_uring/io_uring.c            | 23 +++------------------
 io_uring/io_uring.h            | 16 +++++++++++++++
 io_uring/register.c            |  7 +++++--
 io_uring/rw.c                  | 37 ++++++++++++++++++++++++----------
 6 files changed, 62 insertions(+), 36 deletions(-)