aboutsummaryrefslogtreecommitdiffstats
path: root/mm/nommu.c
diff options
context:
space:
mode:
authorMichel Lespinasse <walken@google.com>2013-02-22 19:32:37 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2013-02-23 20:50:10 -0500
commitbebeb3d68b24bb4132d452c5707fe321208bcbcd (patch)
tree6e609cb7323fb1b4b7026fa0e35867145a181094 /mm/nommu.c
parent940e7da5163029978c2f6b5bbe213607add59062 (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 'mm/nommu.c')
-rw-r--r--mm/nommu.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/mm/nommu.c b/mm/nommu.c
index b20db4e22263..7296a5a280e7 100644
--- a/mm/nommu.c
+++ b/mm/nommu.c
@@ -1250,7 +1250,8 @@ unsigned long do_mmap_pgoff(struct file *file,
1250 unsigned long len, 1250 unsigned long len,
1251 unsigned long prot, 1251 unsigned long prot,
1252 unsigned long flags, 1252 unsigned long flags,
1253 unsigned long pgoff) 1253 unsigned long pgoff,
1254 bool *populate)
1254{ 1255{
1255 struct vm_area_struct *vma; 1256 struct vm_area_struct *vma;
1256 struct vm_region *region; 1257 struct vm_region *region;
@@ -1260,6 +1261,8 @@ unsigned long do_mmap_pgoff(struct file *file,
1260 1261
1261 kenter(",%lx,%lx,%lx,%lx,%lx", addr, len, prot, flags, pgoff); 1262 kenter(",%lx,%lx,%lx,%lx,%lx", addr, len, prot, flags, pgoff);
1262 1263
1264 *populate = false;
1265
1263 /* decide whether we should attempt the mapping, and if so what sort of 1266 /* decide whether we should attempt the mapping, and if so what sort of
1264 * mapping */ 1267 * mapping */
1265 ret = validate_mmap_request(file, addr, len, prot, flags, pgoff, 1268 ret = validate_mmap_request(file, addr, len, prot, flags, pgoff,