io_uring: add IORING_REGISTER_{MAP,UNMAP}_BUFFERS
authorJens Axboe <axboe@kernel.dk>
Tue, 12 Oct 2021 13:19:44 +0000 (07:19 -0600)
committerJens Axboe <axboe@kernel.dk>
Thu, 17 Feb 2022 16:42:56 +0000 (09:42 -0700)
commitd5f6d8af6a16113a99060eddd81cb4b4c373134e
tree4ed8120b7a7b6c912f8a7f125f1d98782a14d6da
parent65c5fe2cd20eb563d54b68350e1d5829541fe72c
io_uring: add IORING_REGISTER_{MAP,UNMAP}_BUFFERS

If supported by the file used for IO, pre-map registered buffers for
DMA. This ties in with registered buffers, and this is only feasible
on a range of buffers that have been registered with
IORING_REGISTER_BUFFERS or IORING_REGISTER_BUFFERS2.

By pre-mapping the buffers for DMA, we retain any DMA mappings across
IO. This means that we no longer have to do a DMA map+unmap for each
IO.

The buffers can be unmapped with IORING_REGISTER_UNMAP_BUFFERS, or
simply just unregistered as per usual and unmapping will happen as
part of that.

This goes for updates through IORING_REGISTER_BUFFERS_UPDATE as well,
if the existing buffer being replaced is DMA mapped, it is unmapped
as part of the update. The new buffer must be DMA mapped afterwards,
if so desired.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
fs/io_uring.c
include/uapi/linux/io_uring.h