diff options
author | Badari Pulavarty <pbadari@us.ibm.com> | 2005-11-07 03:59:27 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2005-11-07 10:53:37 -0500 |
commit | bf8f972d3a1daf969cf44f64cc36d53bfd76441f (patch) | |
tree | c3f0ac2f789c695d13858171144aa5f4ecdc84c1 /ipc | |
parent | d8ba3b731086bcae5468f9ea509f39a921b3f9a6 (diff) |
[PATCH] SHM_NORESERVE flags for shmget()
Add SHM_NORESERVE functionality similar to MAP_NORESERVE for shared memory
segments.
This is mainly to avoid abuse of OVERCOMMIT_ALWAYS and this flag is ignored
for OVERCOMMIT_NEVER.
Signed-off-by: Badari Pulavarty <pbadari@us.ibm.com>
Cc: Hugh Dickins <hugh@veritas.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'ipc')
-rw-r--r-- | ipc/shm.c | 10 |
1 files changed, 9 insertions, 1 deletions
@@ -212,8 +212,16 @@ static int newseg (key_t key, int shmflg, size_t size) | |||
212 | file = hugetlb_zero_setup(size); | 212 | file = hugetlb_zero_setup(size); |
213 | shp->mlock_user = current->user; | 213 | shp->mlock_user = current->user; |
214 | } else { | 214 | } else { |
215 | int acctflag = VM_ACCOUNT; | ||
216 | /* | ||
217 | * Do not allow no accounting for OVERCOMMIT_NEVER, even | ||
218 | * if it's asked for. | ||
219 | */ | ||
220 | if ((shmflg & SHM_NORESERVE) && | ||
221 | sysctl_overcommit_memory != OVERCOMMIT_NEVER) | ||
222 | acctflag = 0; | ||
215 | sprintf (name, "SYSV%08x", key); | 223 | sprintf (name, "SYSV%08x", key); |
216 | file = shmem_file_setup(name, size, VM_ACCOUNT); | 224 | file = shmem_file_setup(name, size, acctflag); |
217 | } | 225 | } |
218 | error = PTR_ERR(file); | 226 | error = PTR_ERR(file); |
219 | if (IS_ERR(file)) | 227 | if (IS_ERR(file)) |