Comment by zbentley
6 months ago
Okay, but . . . how would that work? A syscall gives back a pointer (I thought the point was to avoid syscalls/context switches)? An io_malloc userspace function (great, now how do I manage lifetimes of the buffers it hands out)? Something else?
The memory is allocated by the runtime that has the io_uring backend. You ask it for memory which it manages in its own memory allocator. Lifetime is managed no differently than Vec. For example, when you drop the DmaBuffer [1] it goes back into the pool. Or you hand it off as an I/O submission after filling it up.
The memory frequently needs to be mlocked memory anyway, so a general purpose allocator doesn't work.
[1] https://docs.rs/glommio/latest/glommio/fn.allocate_dma_buffe...