diff options
author | Vasiliy Kulikov <segoon@openwall.com> | 2011-07-26 19:08:48 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2011-07-26 19:49:44 -0400 |
commit | b34a6b1da371ed8af1221459a18c67970f7e3d53 (patch) | |
tree | 5addc850de13623b172395b9d0d7d670930fa6b3 /Documentation/sysctl | |
parent | d40dcdb0172a1ba853464983a059fb45e0aaf61a (diff) |
ipc: introduce shm_rmid_forced sysctl
Add support for the shm_rmid_forced sysctl. If set to 1, all shared
memory objects in current ipc namespace will be automatically forced to
use IPC_RMID.
The POSIX way of handling shmem allows one to create shm objects and
call shmdt(), leaving shm object associated with no process, thus
consuming memory not counted via rlimits.
With shm_rmid_forced=1 the shared memory object is counted at least for
one process, so OOM killer may effectively kill the fat process holding
the shared memory.
It obviously breaks POSIX - some programs relying on the feature would
stop working. So set shm_rmid_forced=1 only if you're sure nobody uses
"orphaned" memory. Use shm_rmid_forced=0 by default for compatability
reasons.
The feature was previously impemented in -ow as a configure option.
[akpm@linux-foundation.org: fix documentation, per Randy]
[akpm@linux-foundation.org: fix warning]
[akpm@linux-foundation.org: readability/conventionality tweaks]
[akpm@linux-foundation.org: fix shm_rmid_forced/shm_forced_rmid confusion, use standard comment layout]
Signed-off-by: Vasiliy Kulikov <segoon@openwall.com>
Cc: Randy Dunlap <rdunlap@xenotime.net>
Cc: "Eric W. Biederman" <ebiederm@xmission.com>
Cc: "Serge E. Hallyn" <serge.hallyn@canonical.com>
Cc: Daniel Lezcano <daniel.lezcano@free.fr>
Cc: Oleg Nesterov <oleg@redhat.com>
Cc: Tejun Heo <tj@kernel.org>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>
Cc: Solar Designer <solar@openwall.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'Documentation/sysctl')
-rw-r--r-- | Documentation/sysctl/kernel.txt | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/Documentation/sysctl/kernel.txt b/Documentation/sysctl/kernel.txt index 1c7fb0a94e28..704e474a93df 100644 --- a/Documentation/sysctl/kernel.txt +++ b/Documentation/sysctl/kernel.txt | |||
@@ -61,6 +61,7 @@ show up in /proc/sys/kernel: | |||
61 | - rtsig-nr | 61 | - rtsig-nr |
62 | - sem | 62 | - sem |
63 | - sg-big-buff [ generic SCSI device (sg) ] | 63 | - sg-big-buff [ generic SCSI device (sg) ] |
64 | - shm_rmid_forced | ||
64 | - shmall | 65 | - shmall |
65 | - shmmax [ sysv ipc ] | 66 | - shmmax [ sysv ipc ] |
66 | - shmmni | 67 | - shmmni |
@@ -518,6 +519,27 @@ kernel. This value defaults to SHMMAX. | |||
518 | 519 | ||
519 | ============================================================== | 520 | ============================================================== |
520 | 521 | ||
522 | shm_rmid_forced: | ||
523 | |||
524 | Linux lets you set resource limits, including how much memory one | ||
525 | process can consume, via setrlimit(2). Unfortunately, shared memory | ||
526 | segments are allowed to exist without association with any process, and | ||
527 | thus might not be counted against any resource limits. If enabled, | ||
528 | shared memory segments are automatically destroyed when their attach | ||
529 | count becomes zero after a detach or a process termination. It will | ||
530 | also destroy segments that were created, but never attached to, on exit | ||
531 | from the process. The only use left for IPC_RMID is to immediately | ||
532 | destroy an unattached segment. Of course, this breaks the way things are | ||
533 | defined, so some applications might stop working. Note that this | ||
534 | feature will do you no good unless you also configure your resource | ||
535 | limits (in particular, RLIMIT_AS and RLIMIT_NPROC). Most systems don't | ||
536 | need this. | ||
537 | |||
538 | Note that if you change this from 0 to 1, already created segments | ||
539 | without users and with a dead originative process will be destroyed. | ||
540 | |||
541 | ============================================================== | ||
542 | |||
521 | softlockup_thresh: | 543 | softlockup_thresh: |
522 | 544 | ||
523 | This value can be used to lower the softlockup tolerance threshold. The | 545 | This value can be used to lower the softlockup tolerance threshold. The |