@@ -2745,6 +2745,12 @@ unsigned long mmap_region(struct file *file, unsigned long addr,
i_mmap_unlock_write(vma->vm_file->f_mapping);
}
+ /*
+ * vma_merge() calls khugepaged_enter_vma() either, the below
+ * call covers the non-merge case.
+ */
+ khugepaged_enter_vma(vma, vma->vm_flags);
+
/* Once vma denies write, undo our temporary denial count */
unmap_writable:
if (file && vm_flags & VM_SHARED)
@@ -34,7 +34,6 @@
#include <linux/export.h>
#include <linux/swap.h>
#include <linux/uio.h>
-#include <linux/khugepaged.h>
#include <linux/hugetlb.h>
#include <linux/fs_parser.h>
#include <linux/swapfile.h>
@@ -2232,7 +2231,6 @@ static int shmem_mmap(struct file *file, struct vm_area_struct *vma)
file_accessed(file);
vma->vm_ops = &shmem_vm_ops;
- khugepaged_enter_vma(vma, vma->vm_flags);
return 0;
}
@@ -4133,8 +4131,6 @@ int shmem_zero_setup(struct vm_area_struct *vma)
vma->vm_file = file;
vma->vm_ops = &shmem_vm_ops;
- khugepaged_enter_vma(vma, vma->vm_flags);
-
return 0;
}