Skip to content

Deduplicate fd-to-ctx conversions

Jens Axboe io-uring 1 version New

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest2 patches 0 repliesNew

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2io_uring/register: don't get a reference to the registered ring fdio_uring/register.c io_uring/rsrc.c+6 -50 replies
2/2io_uring: unify getting ctx from passed in file descriptorio_uring/bpf-ops.c io_uring/io_uring.c io_uring/io_uring.h +3 more+40 -580 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCHSET for-next 0/2] Deduplicate fd-to-ctx conversions

Hi,

io_uring_register_get_file() exists to return a file associated with a struct io_ring_ctx, dealing with both registered ring descriptors and with normal file descriptors. There are a few users of this, but the main io_uring_enter(2) syscall handrolls its own.

Deduplicate that by avoiding the fget/fput for the registered ring descriptor, as that cannot go away since it's private to the task doing the operation. Unify how the file is put because of that, and then we can convert io_uring_enter(2) to use this helper too and move it closer to the hot path of the actual syscall. Then we only have a single way of doing the ctx retrieval, rather than two separate ones.

 io_uring/bpf-ops.c  |  2 +-
 io_uring/io_uring.c | 57 ++++++++++++++++++++++++++++-----------------
 io_uring/io_uring.h |  1 +
 io_uring/register.c | 39 +++----------------------------
 io_uring/register.h |  1 -
 io_uring/rsrc.c     |  5 ++--
 6 files changed, 44 insertions(+), 61 deletions(-)
Signature · 1 line
Jens Axboe