linux-stable/include
Jens Axboe e7a6c00dc7 io_uring: add support for registering ring file descriptors
Lots of workloads use multiple threads, in which case the file table is
shared between them. This makes getting and putting the ring file
descriptor for each io_uring_enter(2) system call more expensive, as it
involves an atomic get and put for each call.

Similarly to how we allow registering normal file descriptors to avoid
this overhead, add support for an io_uring_register(2) API that allows
to register the ring fds themselves:

1) IORING_REGISTER_RING_FDS - takes an array of io_uring_rsrc_update
   structs, and registers them with the task.
2) IORING_UNREGISTER_RING_FDS - takes an array of io_uring_src_update
   structs, and unregisters them.

When a ring fd is registered, it is internally represented by an offset.
This offset is returned to the application, and the application then
uses this offset and sets IORING_ENTER_REGISTERED_RING for the
io_uring_enter(2) system call. This works just like using a registered
file descriptor, rather than a real one, in an SQE, where
IOSQE_FIXED_FILE gets set to tell io_uring that we're using an internal
offset/descriptor rather than a real file descriptor.

In initial testing, this provides a nice bump in performance for
threaded applications in real world cases where the batch count (eg
number of requests submitted per io_uring_enter(2) invocation) is low.
In a microbenchmark, submitting NOP requests, we see the following
increases in performance:

Requests per syscall	Baseline	Registered	Increase
----------------------------------------------------------------
1			 ~7030K		 ~8080K		+15%
2			~13120K		~14800K		+13%
4			~22740K		~25300K		+11%

Co-developed-by: Xiaoguang Wang <xiaoguang.wang@linux.alibaba.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2022-03-10 06:32:49 -07:00
..
acpi
asm-generic bitmap patches for 5.17-rc1 2022-01-23 06:20:44 +02:00
clocksource
crypto lib/crypto: blake2s: avoid indirect calls to compression function for Clang CFI 2022-02-04 19:22:32 +01:00
drm
dt-bindings Fixes for omaps 2022-02-07 17:42:44 +01:00
keys
kunit kunit: replace kernel.h with the necessary inclusions 2022-01-20 08:52:54 +02:00
kvm RISCV: 2022-01-16 16:15:14 +02:00
linux io_uring: add support for registering ring file descriptors 2022-03-10 06:32:49 -07:00
math-emu
media
memory
misc
net ipv6: fix skb drops in igmp6_event_query() and igmp6_event_report() 2022-03-03 09:47:06 -08:00
pcmcia
ras
rdma
scsi Merge branch 'akpm' (patches from Andrew) 2022-01-22 11:28:23 +02:00
soc soc: fsl: Replace kernel.h with the necessary inclusions 2022-02-18 17:11:17 -06:00
sound ASoC: Fixes for v5.17 2022-02-01 16:52:54 +01:00
target
trace io-uring: Make tracepoints consistent. 2022-03-10 06:32:49 -07:00
uapi io_uring: add support for registering ring file descriptors 2022-03-10 06:32:49 -07:00
vdso
video
xen xen: xenbus_dev.h: delete incorrect file name 2022-02-03 08:16:32 +01:00