io_uring is a high-performance asynchronous I/O interface in the Linux kernel. This topic describes the causes of -ENOMEM errors during its creation and provides solutions.
Causes and solutions
Insufficient system memory
Cause
When the system's physical memory is insufficient, the kernel cannot allocate the required memory for
io_uringinitialization or operation.During an
io_uringinstance's creation, the kernel requests locked memory pages. Even with sufficient total system memory, a low locked memory limit may still result in an-ENOMEMerror.Run the following command to view the available memory for the current user:
ulimit -aThe following command output is returned.

max locked memoryis the maximum available locked memory for the user. Locked memory refers to memory pages marked as non-swappable to disks and is used in scenarios that require high performance and low latency.
Solution
Run the target program with root privileges to bypass the lock_memory limits.
For user-purchased Elastic Compute Service (ECS) instances, run the
sudocommand to escalate torootadministrator privileges and run the target program.In container scenarios, check whether the container startup parameters include administrator privileges.
For example, even when you run the programs as root in a Docker container, errors may still occur if you do not configure the
--privileged=truesetting. This prevents the container's root user from fully inheriting the host's root privileges.Warning--privileged=truegrants the container nearly all host privileges. Proceed with caution.
Excessively large io_uring queue parameters
Cause
io_uring allocates memory for the submission queue (SQ) and completion queue (CQ) during initialization. A large queue depth (entries) can exhaust available memory.
Solution
Configure appropriate and reasonable io_uring queue depths.
Avoid specifying excessively large entries values. The io_uring_queue_init and io_uring_queue_init_params interfaces in liburing are used to create io_uring instances. Specify the entries parameters within the allowed memory range.
int io_uring_queue_init(unsigned entries,
struct io_uring *ring,
unsigned flags)
int io_uring_queue_init_params(unsigned entries,
struct io_uring *ring,
struct io_uring_params *params);For more information about these function interfaces, run the man command to view the manual pages after installing liburing.
sudo yum install liburing -y
man io_uring_queue_init