aboutsummaryrefslogtreecommitdiffstats
path: root/ipc/shm.c
diff options
context:
space:
mode:
Diffstat (limited to 'ipc/shm.c')
-rw-r--r--ipc/shm.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/ipc/shm.c b/ipc/shm.c
index dca90489e3b0..587d836d80d9 100644
--- a/ipc/shm.c
+++ b/ipc/shm.c
@@ -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))
@@ -233,10 +241,11 @@ static int newseg (key_t key, int shmflg, size_t size)
233 shp->id = shm_buildid(id,shp->shm_perm.seq); 241 shp->id = shm_buildid(id,shp->shm_perm.seq);
234 shp->shm_file = file; 242 shp->shm_file = file;
235 file->f_dentry->d_inode->i_ino = shp->id; 243 file->f_dentry->d_inode->i_ino = shp->id;
236 if (shmflg & SHM_HUGETLB) 244
237 set_file_hugepages(file); 245 /* Hugetlb ops would have already been assigned. */
238 else 246 if (!(shmflg & SHM_HUGETLB))
239 file->f_op = &shm_file_operations; 247 file->f_op = &shm_file_operations;
248
240 shm_tot += numpages; 249 shm_tot += numpages;
241 shm_unlock(shp); 250 shm_unlock(shp);
242 return shp->id; 251 return shp->id;