简体   繁体   中英

How much locked memory does io_uring_setup need?

When using io_uring_queue_init it calls io_uring_setup . There's an ENOMEM returned when there is insufficient amount of locked memory available for the process.

A strace will look something like:

[pid 37480] io_uring_setup(2048, {flags=0, sq_thread_cpu=0, sq_thread_idle=0}) = -1 ENOMEM (Cannot allocate memory)

What is the formula for how much locked memory is required per entry (first argument)? and if possible, based on the sq_entries/cq_entries in the params structure? Kernel code for the particularly keen. Please don't expand the kernel page size from the formula, as I do want this to be an architecture dependent answer (if it is).

I don't want a dodgy just set ulimit -l to unlimited as an answer. There's this outstanding feature request feature request that would help when implemented.

Thanks to Jens Axboe the following to liburing library calls where added (>=liburing-2.1) returning the size in bytes, 0 if not required, or -errno for errors.

ssize_t io_uring_mlock_size(unsigned entries, unsigned flags);
ssize_t io_uring_mlock_size_params(unsigned entries, struct io_uring_params *p);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM