Skip to content

Commit

Permalink
Merge 'enable sqpoll by default in io_uring' from Preston Thorpe
Browse files Browse the repository at this point in the history
EDIT: will continue iterating on these ideas, as discussed on discord.
for now, this has been changed to just enable `IORING_ENABLE_SQPOLL` by
default. This is supported sin `5.11`, and I believe the last debian
release < that reached EOL in July, so shouldn't be an issue.

Closes #557
  • Loading branch information
penberg committed Dec 31, 2024
2 parents 21a9f29 + 4e77840 commit f8d408e
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion core/io/linux.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ use std::rc::Rc;
use thiserror::Error;

const MAX_IOVECS: usize = 128;
const SQPOLL_IDLE: u32 = 1000;

#[derive(Debug, Error)]
enum LinuxIOError {
Expand Down Expand Up @@ -49,7 +50,13 @@ struct InnerLinuxIO {

impl LinuxIO {
pub fn new() -> Result<Self> {
let ring = io_uring::IoUring::new(MAX_IOVECS as u32)?;
let ring = match io_uring::IoUring::builder()
.setup_sqpoll(SQPOLL_IDLE)
.build(MAX_IOVECS as u32)
{
Ok(ring) => ring,
Err(_) => io_uring::IoUring::new(MAX_IOVECS as u32)?,
};
let inner = InnerLinuxIO {
ring: WrappedIOUring {
ring,
Expand Down

0 comments on commit f8d408e

Please sign in to comment.