mm: introduce mm_populate() for populating new vmas
[~shefty/rdma-dev.git] / mm / util.c
index c55e26b17d93de77dc069d7f30019f7391e0d93f..13467e043e9e24b1d0c6f92560b33f8861f58eca 100644 (file)
--- a/mm/util.c
+++ b/mm/util.c
@@ -355,12 +355,16 @@ unsigned long vm_mmap_pgoff(struct file *file, unsigned long addr,
 {
        unsigned long ret;
        struct mm_struct *mm = current->mm;
+       bool populate;
 
        ret = security_mmap_file(file, prot, flag);
        if (!ret) {
                down_write(&mm->mmap_sem);
-               ret = do_mmap_pgoff(file, addr, len, prot, flag, pgoff);
+               ret = do_mmap_pgoff(file, addr, len, prot, flag, pgoff,
+                                   &populate);
                up_write(&mm->mmap_sem);
+               if (!IS_ERR_VALUE(ret) && populate)
+                       mm_populate(ret, len);
        }
        return ret;
 }