diff options
Diffstat (limited to 'mm/mlock.c')
-rw-r--r-- | mm/mlock.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/mm/mlock.c b/mm/mlock.c index b70919ce4f72..4f318642fbbe 100644 --- a/mm/mlock.c +++ b/mm/mlock.c | |||
@@ -171,7 +171,12 @@ static long __mlock_vma_pages_range(struct vm_area_struct *vma, | |||
171 | VM_BUG_ON(!rwsem_is_locked(&mm->mmap_sem)); | 171 | VM_BUG_ON(!rwsem_is_locked(&mm->mmap_sem)); |
172 | 172 | ||
173 | gup_flags = FOLL_TOUCH | FOLL_GET; | 173 | gup_flags = FOLL_TOUCH | FOLL_GET; |
174 | if (vma->vm_flags & VM_WRITE) | 174 | /* |
175 | * We want to touch writable mappings with a write fault in order | ||
176 | * to break COW, except for shared mappings because these don't COW | ||
177 | * and we would not want to dirty them for nothing. | ||
178 | */ | ||
179 | if ((vma->vm_flags & (VM_WRITE | VM_SHARED)) == VM_WRITE) | ||
175 | gup_flags |= FOLL_WRITE; | 180 | gup_flags |= FOLL_WRITE; |
176 | 181 | ||
177 | /* We don't try to access the guard page of a stack vma */ | 182 | /* We don't try to access the guard page of a stack vma */ |