aio: add support for pre-mapped user IO buffers
If we have fixed user buffers, we can map them into the kernel when we
setup the io_context. That avoids the need to do get_user_pages() for
each and every IO.
To utilize this feature, the application must use the SCQRING interface,
and additionally set IOCTX_FLAG_FIXEDBUFS when creating the IO context
and pass in an array of iovecs that contain the desired buffer addresses
and lengths. These buffers can then be mapped into the kernel for the
life time of the io_context, as opposed to just the duration of the each
single IO.
It's perfectly valid to setup a larger buffer, and then sometimes only
use parts of it for an IO. As long as the range is within the originally
mapped region, it will work just fine.
Only works with non-vectored read/write commands for now, not with
PREADV/PWRITEV.
A limit of 4M is imposed as the largest buffer we currently support.
There's nothing preventing us from going larger, but we need some cap,
and 4M seemed like it would definitely be big enough. RLIMIT_MEMLOCK
is used to cap the total amount of memory pinned.
Signed-off-by: Jens Axboe <axboe@kernel.dk>