|Title: ||Linux Kernel limits|
|Author: ||Michael Marxmeier (email@example.com)|
Linux Kernel limits
This document provides an overview of the default Linux Kernel
limits (kernel parameter) and where they are defined.
Max. number of processes
Defined in /usr/src/linux/include/linux/tasks.h
SEMMNI 128 /* ? max # of semaphore identifiers */
SEMMSL 32 /* <= 512 max num of semaphores per id */
SEMMNS (SEMMNI*SEMMSL) /* ? max # of semaphores in system */
SEMOPM 32 /* ~ 100 max num of ops per semop call */
SEMVMX 32767 /* semaphore maximum value */
/* unused */
SEMUME SEMOPM /* max num of undo entries per process */
SEMMNU SEMMNS /* num of undo structures system wide */
SEMAEM (SEMVMX >> 1) /* adjust on exit max value */
SEMMAP SEMMNS /* # of entries in semaphore map */
SEMUSZ 20 /* sizeof struct sem_undo */
Defined in /usr/src/linux/include/linux/sem.h
* Keep _SHM_ID_BITS as low as possible since SHMMNI
* depends on it and there is a static array of size SHMMNI.
* _SHM_ID_BITS + _SHM_IDX_BITS must be <= 24 on the i386 and
* SHMMAX <= (PAGE_SIZE << _SHM_IDX_BITS).
SHMMAX 0x2000000 /* max shared seg size (bytes) */
SHMMIN 1 /* really PAGE_SIZE */ /* min shared seg size (bytes) */
SHMMNI (1<<_SHM_ID_BITS) /* max num of segs system wide */
/* max shm system wide (pages) */
SHMLBA PAGE_SIZE /* attach addr a multiple of this */
SHMSEG SHMMNI /* max shared segs per process */
Defined in /usr/src/linux/include/asm/shmparam.h
Number of open files
NR_INODE 3072 /* this should be bigger than NR_FILE */
NR_FILE 1024 /* this can well be larger on a larger system */
This can be set dynamically through /proc/sys/kernel/file-max and
Extract from /usr/src/linux-2.1.103/Documentation/sysctl/kernel.txt:
file-max and file-nr
The kernel allocates filehandles dynamically up to a limit
specified by file-max.
The value in file-max denotes the maximum number of file-
handles that the Linux kernel will allocate. When you get lots
of error messages about running out of file handles, you might
want to increase this limit.
The three values in file-nr denote the number of allocated
file handles, the number of used file handles and the maximum
number of file handles. When the allocated filehandles come
close to the maximum, but the number of actually used ones is
far behind, you've encountered a peak in your filehandle usage
and you don't need to increase the maximum.
inode-max and inode-state
As with filehandles, the kernel allocates the inode structures
up to a limit specified by inode-max.
The value in inode-max denotes the maximum number of inode
handlers. This value should be 3-4 times larger than the value
in file-max, since stdin, stdout and network sockets also
need an inode struct to handle them. When you regularly run
out of inodes, you need to increase this value.
The file inode-nr contains two values, nr_inodes and
Nr_inodes stands for the number of inodes the system has
allocated, this can be slightly more than inode-max because
Linux allocates them one pageful at a time.
Nr_free_inodes represents the number of free inodes (?).
Number of pty devices
Since the Linux kernel currently uses 8 bit minor numbers, the
max. number of pty devices is limited to 256.