mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-28 02:32:09 -04:00
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. [[email protected]: fix documentation, per Randy] [[email protected]: fix warning] [[email protected]: readability/conventionality tweaks] [[email protected]: fix shm_rmid_forced/shm_forced_rmid confusion, use standard comment layout] Signed-off-by: Vasiliy Kulikov <[email protected]> Cc: Randy Dunlap <[email protected]> Cc: "Eric W. Biederman" <[email protected]> Cc: "Serge E. Hallyn" <[email protected]> Cc: Daniel Lezcano <[email protected]> Cc: Oleg Nesterov <[email protected]> Cc: Tejun Heo <[email protected]> Cc: Ingo Molnar <[email protected]> Cc: Alan Cox <[email protected]> Cc: Solar Designer <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
This commit is contained in:
parent
d40dcdb017
commit
b34a6b1da3
6 changed files with 163 additions and 4 deletions
|
|
@ -61,6 +61,7 @@ show up in /proc/sys/kernel:
|
|||
- rtsig-nr
|
||||
- sem
|
||||
- sg-big-buff [ generic SCSI device (sg) ]
|
||||
- shm_rmid_forced
|
||||
- shmall
|
||||
- shmmax [ sysv ipc ]
|
||||
- shmmni
|
||||
|
|
@ -518,6 +519,27 @@ kernel. This value defaults to SHMMAX.
|
|||
|
||||
==============================================================
|
||||
|
||||
shm_rmid_forced:
|
||||
|
||||
Linux lets you set resource limits, including how much memory one
|
||||
process can consume, via setrlimit(2). Unfortunately, shared memory
|
||||
segments are allowed to exist without association with any process, and
|
||||
thus might not be counted against any resource limits. If enabled,
|
||||
shared memory segments are automatically destroyed when their attach
|
||||
count becomes zero after a detach or a process termination. It will
|
||||
also destroy segments that were created, but never attached to, on exit
|
||||
from the process. The only use left for IPC_RMID is to immediately
|
||||
destroy an unattached segment. Of course, this breaks the way things are
|
||||
defined, so some applications might stop working. Note that this
|
||||
feature will do you no good unless you also configure your resource
|
||||
limits (in particular, RLIMIT_AS and RLIMIT_NPROC). Most systems don't
|
||||
need this.
|
||||
|
||||
Note that if you change this from 0 to 1, already created segments
|
||||
without users and with a dead originative process will be destroyed.
|
||||
|
||||
==============================================================
|
||||
|
||||
softlockup_thresh:
|
||||
|
||||
This value can be used to lower the softlockup tolerance threshold. The
|
||||
|
|
|
|||
Loading…
Reference in a new issue