feat: add SQPOLL support for io_uring#7960
feat: add SQPOLL support for io_uring#7960SidongYang wants to merge 1 commit intotokio-rs:masterfrom
Conversation
tokio/src/runtime/builder.rs
Outdated
| /// .unwrap(); | ||
| /// ``` | ||
| #[cfg_attr(docsrs, doc(cfg(feature = "io-uring")))] | ||
| pub fn uring_setup_sqpoll(&mut self, idle: u32) -> &mut Self { |
There was a problem hiding this comment.
| pub fn uring_setup_sqpoll(&mut self, idle: u32) -> &mut Self { | |
| pub fn uring_setup_sqpoll(&mut self, idle_timeout: u32) -> &mut Self { |
tokio/src/runtime/builder.rs
Outdated
| /// ``` | ||
| #[cfg_attr(docsrs, doc(cfg(feature = "io-uring")))] | ||
| pub fn uring_setup_sqpoll(&mut self, idle: u32) -> &mut Self { | ||
| self.uring_setup_sqpoll = Some(idle); |
There was a problem hiding this comment.
| self.uring_setup_sqpoll = Some(idle); | |
| self.uring_setup_sqpoll = Some(idle_timeout); |
tokio/src/runtime/builder.rs
Outdated
| self | ||
| } | ||
|
|
||
| /// Enables SQPOLL for the io_uring driver and sets the idle timeout. |
There was a problem hiding this comment.
| /// Enables SQPOLL for the io_uring driver and sets the idle timeout. | |
| /// Enables SQPOLL for the io_uring driver and sets the idle timeout (in milliseconds). |
if the timeout is in millis. Otherwise, please mention the correct time unit.
69d5df8 to
54468ed
Compare
|
I have updated the PR to address the remaining review comments:
|
|
Please fix the formatting issues and update to master to fix the FreeBSD build |
54468ed to
23df36c
Compare
|
@martin-g Thanks, I've fixed formatting and rebased this branch. |
|
Now the spellchecker is complaining. |
23df36c to
d300d94
Compare
|
Thanks, @martin-g . I've added SQPOLL to the spellcheck file and incremented the number on the first line. |
| feature = "rt", | ||
| feature = "fs", | ||
| target_os = "linux" | ||
| ))] |
There was a problem hiding this comment.
Sure, I've added a line for rustdoc above. Thanks.
This adds `uring_setup_sqpoll` to the Runtime `Builder`, allowing the io_uring driver to be configured with SQPOLL enabled. This offloads submission queue polling to a kernel thread, which can significantly reduce syscall overhead. - Added `uring_setup_sqpoll` to `tokio::runtime::Builder`. - Updated `UringContext` to sync the submission queue and check `need_wakeup`. - Added tests to verify `sqpoll` in both single-thread and multi-thread runtimes.
d300d94 to
c56fda6
Compare
This adds
uring_setup_sqpollto the RuntimeBuilder, allowing the io_uring driverto be configured with SQPOLL enabled. This offloads submission queue polling to a
kernel thread, which can significantly reduce syscall overhead.
uring_setup_sqpolltotokio::runtime::Builder.UringContextto sync the submission queue and checkneed_wakeup.sqpollin both single-thread and multi-thread runtimes.