io_uring_mlock_size(3) liburing Manual io_uring_mlock_size(3)

io_uring_mlock_size - get required memlock size for a ring

#include <liburing.h>
ssize_t io_uring_mlock_size(unsigned entries, unsigned flags);

The io_uring_mlock_size(3) function returns the required RLIMIT_MEMLOCK memory size for an io_uring ring with entries entries and the specified setup flags.

On newer kernels (5.12+), io_uring no longer requires any memlock memory and this function will return 0. On older kernels (5.11 and prior), this returns the required memory so that the caller can ensure that enough RLIMIT_MEMLOCK space is available before setting up a ring.

For more control over the ring parameters, use io_uring_mlock_size_params(3) instead.

Returns the required memlock size in bytes on success, 0 if no memlock is needed, or a negative errno value on error.

io_uring_mlock_size_params(3), io_uring_memory_size(3), io_uring_queue_init(3), getrlimit(2)

January 18, 2025 liburing-2.4