diff options
author | Michel Lespinasse <walken@google.com> | 2013-02-22 19:32:37 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2013-02-23 20:50:10 -0500 |
commit | bebeb3d68b24bb4132d452c5707fe321208bcbcd (patch) | |
tree | 6e609cb7323fb1b4b7026fa0e35867145a181094 /include | |
parent | 940e7da5163029978c2f6b5bbe213607add59062 (diff) |
mm: introduce mm_populate() for populating new vmas
When creating new mappings using the MAP_POPULATE / MAP_LOCKED flags (or
with MCL_FUTURE in effect), we want to populate the pages within the
newly created vmas. This may take a while as we may have to read pages
from disk, so ideally we want to do this outside of the write-locked
mmap_sem region.
This change introduces mm_populate(), which is used to defer populating
such mappings until after the mmap_sem write lock has been released.
This is implemented as a generalization of the former do_mlock_pages(),
which accomplished the same task but was using during mlock() /
mlockall().
Signed-off-by: Michel Lespinasse <walken@google.com>
Reported-by: Andy Lutomirski <luto@amacapital.net>
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 'include')
-rw-r--r-- | include/linux/mm.h | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/include/linux/mm.h b/include/linux/mm.h index 9d9dcc35d6a1..da0a0fe970c2 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h | |||
@@ -1474,11 +1474,23 @@ extern unsigned long get_unmapped_area(struct file *, unsigned long, unsigned lo | |||
1474 | extern unsigned long mmap_region(struct file *file, unsigned long addr, | 1474 | extern unsigned long mmap_region(struct file *file, unsigned long addr, |
1475 | unsigned long len, unsigned long flags, | 1475 | unsigned long len, unsigned long flags, |
1476 | vm_flags_t vm_flags, unsigned long pgoff); | 1476 | vm_flags_t vm_flags, unsigned long pgoff); |
1477 | extern unsigned long do_mmap_pgoff(struct file *, unsigned long, | 1477 | extern unsigned long do_mmap_pgoff(struct file *file, unsigned long addr, |
1478 | unsigned long, unsigned long, | 1478 | unsigned long len, unsigned long prot, unsigned long flags, |
1479 | unsigned long, unsigned long); | 1479 | unsigned long pgoff, bool *populate); |
1480 | extern int do_munmap(struct mm_struct *, unsigned long, size_t); | 1480 | extern int do_munmap(struct mm_struct *, unsigned long, size_t); |
1481 | 1481 | ||
1482 | #ifdef CONFIG_MMU | ||
1483 | extern int __mm_populate(unsigned long addr, unsigned long len, | ||
1484 | int ignore_errors); | ||
1485 | static inline void mm_populate(unsigned long addr, unsigned long len) | ||
1486 | { | ||
1487 | /* Ignore errors */ | ||
1488 | (void) __mm_populate(addr, len, 1); | ||
1489 | } | ||
1490 | #else | ||
1491 | static inline void mm_populate(unsigned long addr, unsigned long len) {} | ||
1492 | #endif | ||
1493 | |||
1482 | /* These take the mm semaphore themselves */ | 1494 | /* These take the mm semaphore themselves */ |
1483 | extern unsigned long vm_brk(unsigned long, unsigned long); | 1495 | extern unsigned long vm_brk(unsigned long, unsigned long); |
1484 | extern int vm_munmap(unsigned long, size_t); | 1496 | extern int vm_munmap(unsigned long, size_t); |