Question

According to the manpage, "-l" in ulimit means "The maximum size that may be locked into memory". What does this sentence mean, exactly? How may it affect running programs?

Was it helpful?

Solution

Memory that is locked may not be paged out - this reduces the amount of memory that is available for other processes. This setting limits the amount of memory that can be locked.

OTHER TIPS

This limits how much memory you can make unswappable with mlock

The setrlimit manpage says:

The maximum number of bytes of memory that may be locked into RAM. In effect this limit is rounded down to the nearest multiple of the system page size. This limit affects mlock(2) and mlockall(2) and the mmap(2) MAP_LOCKED operation. Since Linux 2.6.9 it also affects the shmctl(2) SHM_LOCK operation, where it sets a maximum on the total bytes in shared memory segments (see shmget(2)) that may be locked by the real user ID of the calling process. The shmctl(2) SHM_LOCK locks are accounted for separately from the per-process memory locks established by mlock(2), mlockall(2), and mmap(2) MAP_LOCKED; a process can lock bytes up to this limit in each of these two categories. In Linux kernels before 2.6.9, this limit controlled the amount of memory that could be locked by a privileged process. Since Linux 2.6.9, no limits are placed on the amount of memory that a privileged process may lock, and this limit instead governs the amount of memory that an unprivileged process may lock.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top