diff options
-rw-r--r-- | include/linux/shm.h | 1 | ||||
-rw-r--r-- | ipc/shm.c | 10 |
2 files changed, 10 insertions, 1 deletions
diff --git a/include/linux/shm.h b/include/linux/shm.h index 80113a1f60bc..a2c896ad0bef 100644 --- a/include/linux/shm.h +++ b/include/linux/shm.h | |||
@@ -92,6 +92,7 @@ struct shmid_kernel /* private to the kernel */ | |||
92 | #define SHM_DEST 01000 /* segment will be destroyed on last detach */ | 92 | #define SHM_DEST 01000 /* segment will be destroyed on last detach */ |
93 | #define SHM_LOCKED 02000 /* segment will not be swapped */ | 93 | #define SHM_LOCKED 02000 /* segment will not be swapped */ |
94 | #define SHM_HUGETLB 04000 /* segment will use huge TLB pages */ | 94 | #define SHM_HUGETLB 04000 /* segment will use huge TLB pages */ |
95 | #define SHM_NORESERVE 010000 /* don't check for reservations */ | ||
95 | 96 | ||
96 | #ifdef CONFIG_SYSVIPC | 97 | #ifdef CONFIG_SYSVIPC |
97 | long do_shmat(int shmid, char __user *shmaddr, int shmflg, unsigned long *addr); | 98 | long do_shmat(int shmid, char __user *shmaddr, int shmflg, unsigned long *addr); |
@@ -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)) |