diff options
Diffstat (limited to 'mm/mlock.c')
-rw-r--r-- | mm/mlock.c | 17 |
1 files changed, 2 insertions, 15 deletions
diff --git a/mm/mlock.c b/mm/mlock.c index c3924c7f00be..6b55e3efe0df 100644 --- a/mm/mlock.c +++ b/mm/mlock.c | |||
@@ -135,13 +135,6 @@ void munlock_vma_page(struct page *page) | |||
135 | } | 135 | } |
136 | } | 136 | } |
137 | 137 | ||
138 | static inline int stack_guard_page(struct vm_area_struct *vma, unsigned long addr) | ||
139 | { | ||
140 | return (vma->vm_flags & VM_GROWSDOWN) && | ||
141 | (vma->vm_start == addr) && | ||
142 | !vma_stack_continue(vma->vm_prev, addr); | ||
143 | } | ||
144 | |||
145 | /** | 138 | /** |
146 | * __mlock_vma_pages_range() - mlock a range of pages in the vma. | 139 | * __mlock_vma_pages_range() - mlock a range of pages in the vma. |
147 | * @vma: target vma | 140 | * @vma: target vma |
@@ -188,12 +181,6 @@ static long __mlock_vma_pages_range(struct vm_area_struct *vma, | |||
188 | if (vma->vm_flags & VM_LOCKED) | 181 | if (vma->vm_flags & VM_LOCKED) |
189 | gup_flags |= FOLL_MLOCK; | 182 | gup_flags |= FOLL_MLOCK; |
190 | 183 | ||
191 | /* We don't try to access the guard page of a stack vma */ | ||
192 | if (stack_guard_page(vma, start)) { | ||
193 | addr += PAGE_SIZE; | ||
194 | nr_pages--; | ||
195 | } | ||
196 | |||
197 | return __get_user_pages(current, mm, addr, nr_pages, gup_flags, | 184 | return __get_user_pages(current, mm, addr, nr_pages, gup_flags, |
198 | NULL, NULL, nonblocking); | 185 | NULL, NULL, nonblocking); |
199 | } | 186 | } |
@@ -237,7 +224,7 @@ long mlock_vma_pages_range(struct vm_area_struct *vma, | |||
237 | 224 | ||
238 | if (!((vma->vm_flags & (VM_DONTEXPAND | VM_RESERVED)) || | 225 | if (!((vma->vm_flags & (VM_DONTEXPAND | VM_RESERVED)) || |
239 | is_vm_hugetlb_page(vma) || | 226 | is_vm_hugetlb_page(vma) || |
240 | vma == get_gate_vma(current))) { | 227 | vma == get_gate_vma(current->mm))) { |
241 | 228 | ||
242 | __mlock_vma_pages_range(vma, start, end, NULL); | 229 | __mlock_vma_pages_range(vma, start, end, NULL); |
243 | 230 | ||
@@ -332,7 +319,7 @@ static int mlock_fixup(struct vm_area_struct *vma, struct vm_area_struct **prev, | |||
332 | int lock = newflags & VM_LOCKED; | 319 | int lock = newflags & VM_LOCKED; |
333 | 320 | ||
334 | if (newflags == vma->vm_flags || (vma->vm_flags & VM_SPECIAL) || | 321 | if (newflags == vma->vm_flags || (vma->vm_flags & VM_SPECIAL) || |
335 | is_vm_hugetlb_page(vma) || vma == get_gate_vma(current)) | 322 | is_vm_hugetlb_page(vma) || vma == get_gate_vma(current->mm)) |
336 | goto out; /* don't set VM_LOCKED, don't count */ | 323 | goto out; /* don't set VM_LOCKED, don't count */ |
337 | 324 | ||
338 | pgoff = vma->vm_pgoff + ((start - vma->vm_start) >> PAGE_SHIFT); | 325 | pgoff = vma->vm_pgoff + ((start - vma->vm_start) >> PAGE_SHIFT); |