diff options
author | Michel Lespinasse <walken@google.com> | 2013-02-22 19:32:43 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2013-02-23 20:50:11 -0500 |
commit | c22c0d6344c362b1dde5d8e160d3d07536aca120 (patch) | |
tree | 00350da7f08f8a1b8495294bccc05d768fb1682e /mm | |
parent | 81909b842107ef8ca499f46ecb9b7afd87c20c52 (diff) |
mm: remove flags argument to mmap_region
After the MAP_POPULATE handling has been moved to mmap_region() call
sites, the only remaining use of the flags argument is to pass the
MAP_NORESERVE flag. This can be just as easily handled by
do_mmap_pgoff(), so do that and remove the mmap_region() flags
parameter.
[akpm@linux-foundation.org: remove double parens]
Signed-off-by: Michel Lespinasse <walken@google.com>
Acked-by: Rik van Riel <riel@redhat.com>
Tested-by: Andy Lutomirski <luto@amacapital.net>
Cc: Greg Ungerer <gregungerer@westnet.com.au>
Cc: David Howells <dhowells@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm')
-rw-r--r-- | mm/fremap.c | 3 | ||||
-rw-r--r-- | mm/mmap.c | 33 |
2 files changed, 17 insertions, 19 deletions
diff --git a/mm/fremap.c b/mm/fremap.c index b42e32171530..503a72387087 100644 --- a/mm/fremap.c +++ b/mm/fremap.c | |||
@@ -204,9 +204,8 @@ get_write_lock: | |||
204 | unsigned long addr; | 204 | unsigned long addr; |
205 | struct file *file = get_file(vma->vm_file); | 205 | struct file *file = get_file(vma->vm_file); |
206 | 206 | ||
207 | flags = (flags & MAP_NONBLOCK) | MAP_POPULATE; | ||
208 | addr = mmap_region(file, start, size, | 207 | addr = mmap_region(file, start, size, |
209 | flags, vma->vm_flags, pgoff); | 208 | vma->vm_flags, pgoff); |
210 | fput(file); | 209 | fput(file); |
211 | if (IS_ERR_VALUE(addr)) { | 210 | if (IS_ERR_VALUE(addr)) { |
212 | err = addr; | 211 | err = addr; |
@@ -1291,7 +1291,21 @@ unsigned long do_mmap_pgoff(struct file *file, unsigned long addr, | |||
1291 | } | 1291 | } |
1292 | } | 1292 | } |
1293 | 1293 | ||
1294 | addr = mmap_region(file, addr, len, flags, vm_flags, pgoff); | 1294 | /* |
1295 | * Set 'VM_NORESERVE' if we should not account for the | ||
1296 | * memory use of this mapping. | ||
1297 | */ | ||
1298 | if (flags & MAP_NORESERVE) { | ||
1299 | /* We honor MAP_NORESERVE if allowed to overcommit */ | ||
1300 | if (sysctl_overcommit_memory != OVERCOMMIT_NEVER) | ||
1301 | vm_flags |= VM_NORESERVE; | ||
1302 | |||
1303 | /* hugetlb applies strict overcommit unless MAP_NORESERVE */ | ||
1304 | if (file && is_file_hugepages(file)) | ||
1305 | vm_flags |= VM_NORESERVE; | ||
1306 | } | ||
1307 | |||
1308 | addr = mmap_region(file, addr, len, vm_flags, pgoff); | ||
1295 | if (!IS_ERR_VALUE(addr) && | 1309 | if (!IS_ERR_VALUE(addr) && |
1296 | ((vm_flags & VM_LOCKED) || | 1310 | ((vm_flags & VM_LOCKED) || |
1297 | (flags & (MAP_POPULATE | MAP_NONBLOCK)) == MAP_POPULATE)) | 1311 | (flags & (MAP_POPULATE | MAP_NONBLOCK)) == MAP_POPULATE)) |
@@ -1411,8 +1425,7 @@ static inline int accountable_mapping(struct file *file, vm_flags_t vm_flags) | |||
1411 | } | 1425 | } |
1412 | 1426 | ||
1413 | unsigned long mmap_region(struct file *file, unsigned long addr, | 1427 | unsigned long mmap_region(struct file *file, unsigned long addr, |
1414 | unsigned long len, unsigned long flags, | 1428 | unsigned long len, vm_flags_t vm_flags, unsigned long pgoff) |
1415 | vm_flags_t vm_flags, unsigned long pgoff) | ||
1416 | { | 1429 | { |
1417 | struct mm_struct *mm = current->mm; | 1430 | struct mm_struct *mm = current->mm; |
1418 | struct vm_area_struct *vma, *prev; | 1431 | struct vm_area_struct *vma, *prev; |
@@ -1436,20 +1449,6 @@ munmap_back: | |||
1436 | return -ENOMEM; | 1449 | return -ENOMEM; |
1437 | 1450 | ||
1438 | /* | 1451 | /* |
1439 | * Set 'VM_NORESERVE' if we should not account for the | ||
1440 | * memory use of this mapping. | ||
1441 | */ | ||
1442 | if ((flags & MAP_NORESERVE)) { | ||
1443 | /* We honor MAP_NORESERVE if allowed to overcommit */ | ||
1444 | if (sysctl_overcommit_memory != OVERCOMMIT_NEVER) | ||
1445 | vm_flags |= VM_NORESERVE; | ||
1446 | |||
1447 | /* hugetlb applies strict overcommit unless MAP_NORESERVE */ | ||
1448 | if (file && is_file_hugepages(file)) | ||
1449 | vm_flags |= VM_NORESERVE; | ||
1450 | } | ||
1451 | |||
1452 | /* | ||
1453 | * Private writable mapping: check memory availability | 1452 | * Private writable mapping: check memory availability |
1454 | */ | 1453 | */ |
1455 | if (accountable_mapping(file, vm_flags)) { | 1454 | if (accountable_mapping(file, vm_flags)) { |