[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] Use io_uring_register_ring_fd() to skip fd operations
From: |
Sam Li |
Subject: |
[PATCH] Use io_uring_register_ring_fd() to skip fd operations |
Date: |
Mon, 18 Apr 2022 15:52:28 +0800 |
Linux recently added a new io_uring(7) optimization API that QEMU
doesn't take advantage of yet. The liburing library that QEMU uses
has added a corresponding new API calling io_uring_register_ring_fd().
When this API is called after creating the ring, the io_uring_submit()
library function passes a flag to the io_uring_enter(2) syscall
allowing it to skip the ring file descriptor fdget()/fdput()
operations. This saves some CPU cycles.
Signed-off-by: Sam Li <faithilikerun@gmail.com>
---
block/io_uring.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/block/io_uring.c b/block/io_uring.c
index 782afdb433..2942967126 100644
--- a/block/io_uring.c
+++ b/block/io_uring.c
@@ -435,6 +435,9 @@ LuringState *luring_init(Error **errp)
}
ioq_init(&s->io_q);
+ if (io_uring_register_ring_fd(&s->ring) < 0) {
+ error_setg_errno(errp, errno, "failed to register linux
io_uring ring file descriptor");
+ }
return s;
}
--
2.35.1
- [PATCH] Use io_uring_register_ring_fd() to skip fd operations,
Sam Li <=