|
@@ -162,7 +162,7 @@ static long __mlock_vma_pages_range(struct vm_area_struct *vma,
|
|
VM_BUG_ON(end > vma->vm_end);
|
|
VM_BUG_ON(end > vma->vm_end);
|
|
VM_BUG_ON(!rwsem_is_locked(&mm->mmap_sem));
|
|
VM_BUG_ON(!rwsem_is_locked(&mm->mmap_sem));
|
|
|
|
|
|
- gup_flags = FOLL_TOUCH;
|
|
|
|
|
|
+ gup_flags = FOLL_TOUCH | FOLL_MLOCK;
|
|
/*
|
|
/*
|
|
* We want to touch writable mappings with a write fault in order
|
|
* We want to touch writable mappings with a write fault in order
|
|
* to break COW, except for shared mappings because these don't COW
|
|
* to break COW, except for shared mappings because these don't COW
|
|
@@ -178,9 +178,6 @@ static long __mlock_vma_pages_range(struct vm_area_struct *vma,
|
|
if (vma->vm_flags & (VM_READ | VM_WRITE | VM_EXEC))
|
|
if (vma->vm_flags & (VM_READ | VM_WRITE | VM_EXEC))
|
|
gup_flags |= FOLL_FORCE;
|
|
gup_flags |= FOLL_FORCE;
|
|
|
|
|
|
- if (vma->vm_flags & VM_LOCKED)
|
|
|
|
- gup_flags |= FOLL_MLOCK;
|
|
|
|
-
|
|
|
|
return __get_user_pages(current, mm, addr, nr_pages, gup_flags,
|
|
return __get_user_pages(current, mm, addr, nr_pages, gup_flags,
|
|
NULL, NULL, nonblocking);
|
|
NULL, NULL, nonblocking);
|
|
}
|
|
}
|