RLIMIT_MEMLOCK
Maximum bytes the process may lock into RAM.
- Resource number
- 8
- Row in /proc/PID/limits
- Max locked memory
- bash ulimit flag
- ulimit -l
- Unit in /proc/PID/limits
- bytes
- Group
- Memory
What happens at the limit
A process with CAP_IPC_LOCK is exempt. Before Linux 2.6.9 this limit governed how much a privileged process could lock; since then it governs unprivileged ones. Anything that pins memory, RDMA registration for one, tends to run into it first, and the usual symptom is an ENOMEM on a box with plenty of free memory.
Check a running process with grep -i "Max locked memory" /proc/PID/limits, or paste the whole file into the limits reader. Inspect or change one on a live process with prlimit --pid PID(util-linux).
Syscall cards that mention it
- memfd_secret(2)Linux · Memory
Create memory removed from the kernel's direct map, mapped only by fd holders.
- mlock(2)Linux · Memory
Lock pages into RAM so they can't be swapped out; mlockall() does the whole address space.
Rod on this
Sources
Resource numbers are from asm-generic/resource.h; a few architectures (Alpha, MIPS, SPARC) number some limits differently. The list of syscall cards is matched by name from the card text on this site, not from the kernel source. Spot one that's wrong? Tell Rod.