News for hackers. Stuff that matters.

stbuehler

Re:Async-await on stable Rust on Thursday November 07, 2019 @12:34PM (#21475231)
That is exactly what `async` blocks are about: they do support self-referential structs, and `Pin` is what allows us to use those in a safe way, as `Pin`ned data can't be moved again (unless the data is `Unpin`, which self-referential structs are not), so the self-references are safe.
Re:Efficient IO with io_uring [pdf] on Tuesday May 07, 2019 @01:33PM (#19851593)
I'm not sure about the details for file I/O; files with FMODE_NOWAIT should be fine (block devices, ext4, btrfs, ...).

The idea is that during submission an operation is started with IOCB_NOWAIT; an operation shouldn't block with that. If it returns EAGAIN it will be retried in another kernel thread without IOCB_NOWAIT. Afaik IOCB_NOWAIT support should be announced through FMODE_NOWAIT.

Right now operations that don't support IOCB_NOWAIT ("magic check" in io_file_supports_async [1]) are still run during submission but without the IOCB_NOWAIT flag.

Sockets/pipes don't handle IOCB_NOWAIT, they only care about O_NONBLOCK right now (which is a bug imho).

[1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/lin...

Re:Efficient IO with io_uring [pdf] on Tuesday May 07, 2019 @01:15PM (#19851402)
https://github.com/stbuehler/rust-io-uring

Note that io_uring in linux 5.1 has various bugs; especially READ* and WRITE* on sockets/pipe don't work very well (afaik they either block submission or return -EAGAIN with O_NONBLOCK), so the example code in my repo isn't that useful for linux 5.1 (POLL_ADD works fine though).

For proper support in tokio this would have to be done in mio afaict (or tokio would have to replace mio with something else).