aboutsummaryrefslogtreecommitdiffstats
path: root/ipc/shm.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2009-01-31 18:08:56 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2009-01-31 18:08:56 -0500
commitfc8744adc870a8d4366908221508bb113d8b72ee (patch)
tree755f4c4a1cc30567fde4e60c9cc5e6a889c360b0 /ipc/shm.c
parent33bfad54b58cf05cfe6678c3ec9235d4bc8db4c2 (diff)
Stop playing silly games with the VM_ACCOUNT flag
The mmap_region() code would temporarily set the VM_ACCOUNT flag for anonymous shared mappings just to inform shmem_zero_setup() that it should enable accounting for the resulting shm object. It would then clear the flag after calling ->mmap (for the /dev/zero case) or doing shmem_zero_setup() (for the MAP_ANON case). This just resulted in vma merge issues, but also made for just unnecessary confusion. Use the already-existing VM_NORESERVE flag for this instead, and let shmem_{zero|file}_setup() just figure it out from that. This also happens to make it obvious that the new DRI2 GEM layer uses a non-reserving backing store for its object allocation - which is quite possibly not intentional. But since I didn't want to change semantics in this patch, I left it alone, and just updated the caller to use the new flag semantics. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'ipc/shm.c')
-rw-r--r--ipc/shm.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/ipc/shm.c b/ipc/shm.c
index a9e09ad2263e..c0a021f7f41a 100644
--- a/ipc/shm.c
+++ b/ipc/shm.c
@@ -368,14 +368,14 @@ static int newseg(struct ipc_namespace *ns, struct ipc_params *params)
368 file = hugetlb_file_setup(name, size); 368 file = hugetlb_file_setup(name, size);
369 shp->mlock_user = current_user(); 369 shp->mlock_user = current_user();
370 } else { 370 } else {
371 int acctflag = VM_ACCOUNT; 371 int acctflag = 0;
372 /* 372 /*
373 * Do not allow no accounting for OVERCOMMIT_NEVER, even 373 * Do not allow no accounting for OVERCOMMIT_NEVER, even
374 * if it's asked for. 374 * if it's asked for.
375 */ 375 */
376 if ((shmflg & SHM_NORESERVE) && 376 if ((shmflg & SHM_NORESERVE) &&
377 sysctl_overcommit_memory != OVERCOMMIT_NEVER) 377 sysctl_overcommit_memory != OVERCOMMIT_NEVER)
378 acctflag = 0; 378 acctflag = VM_NORESERVE;
379 file = shmem_file_setup(name, size, acctflag); 379 file = shmem_file_setup(name, size, acctflag);
380 } 380 }
381 error = PTR_ERR(file); 381 error = PTR_ERR(file);