compio-rs / compio

A thread-per-core Rust runtime with IOCP/io_uring/polling.
MIT License
420 stars 37 forks source link

Ring mapped buffers support #102

Closed Sherlock-Holo closed 11 months ago

Sherlock-Holo commented 1 year ago

add RingMappedBuffers support, allow users to use io-uring Provider Buffers features

Berrysoft commented 1 year ago

If you would like to continue this PR, please consider the following:

Sherlock-Holo commented 1 year ago

The interface should be complete. We should enable read_at, recv and recv_from with ring buffer. IO traits and extension (e.g. recv_exact) should be provided.

I can try to add ring mapped buffers support for read_at, recv, recv_from and recv_exact

The interface should be cross-platform. We highly recommand providing a software emulation for other drivers, and for low version Linux (Ubuntu 20.04).

this part needs more thinking and trying, like how to unify the interface

The allocation of ring buffer should be determined by the user, instead of forcing mmap.

liburing example also use mmap https://github.com/axboe/liburing/blob/master/examples/io_uring-udp.c#L56, io_uring_register_buf_ring(3) says

The ring_addr field must contain the address to the memory allocated to fit this ring. The memory must be page aligned and hence allocated appropriately using eg posix_memalign(3) or similar.

I am not sure there are other better ways to create a ring mapped buffers

George-Miao commented 1 year ago

Also please add scope to commits. See CONTRIBUTING.md for detail. Before merging a rebase -i is required.

George-Miao commented 11 months ago

Close PR for now. Feel free to re-open if further progress is made.