Commit 05f3fb3c authored by Jens Axboe's avatar Jens Axboe

io_uring: avoid ring quiesce for fixed file set unregister and update

We currently fully quiesce the ring before an unregister or update of
the fixed fileset. This is very expensive, and we can be a bit smarter
about this.

Add a percpu refcount for the file tables as a whole. Grab a percpu ref
when we use a registered file, and put it on completion. This is cheap
to do. Upon removal of a file from a set, switch the ref count to atomic
mode. When we hit zero ref on the completion side, then we know we can
drop the previously registered files. When the old files have been
dropped, switch the ref back to percpu mode for normal operation.

Since there's a period between doing the update and the kernel being
done with it, add a IORING_OP_FILES_UPDATE opcode that can perform the
same action. The application knows the update has completed when it gets
the CQE for it. Between doing the update and receiving this completion,
the application must continue to use the unregistered fd if submitting
IO on this particular file.

This takes the runtime of test/file-register from liburing from 14s to
about 0.7s.
Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent b5dba59e
This diff is collapsed.
...@@ -80,6 +80,7 @@ enum { ...@@ -80,6 +80,7 @@ enum {
IORING_OP_FALLOCATE, IORING_OP_FALLOCATE,
IORING_OP_OPENAT, IORING_OP_OPENAT,
IORING_OP_CLOSE, IORING_OP_CLOSE,
IORING_OP_FILES_UPDATE,
/* this goes last, obviously */ /* this goes last, obviously */
IORING_OP_LAST, IORING_OP_LAST,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment