mm: directly use __mlock_vma_pages_range() in find_extend_vma()
In find_extend_vma(), we don't need mlock_vma_pages_range() to verify the vma type - we know we're working with a stack. So, we can call directly into __mlock_vma_pages_range(), and remove the last make_pages_present() call site. Note that we don't use mm_populate() here, so we can't release the mmap_sem while allocating new stack pages. This is deemed acceptable, because the stack vmas grow by a bounded number of pages at a time, and these are anon pages so we don't have to read from disk to populate them. Signed-off-by: Michel Lespinasse <walken@google.com> Acked-by: Rik van Riel <riel@redhat.com> Tested-by: Andy Lutomirski <luto@amacapital.net> Cc: Greg Ungerer <gregungerer@westnet.com.au> Cc: David Howells <dhowells@redhat.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:

committed by
Linus Torvalds

parent
c22c0d6344
commit
cea10a19b7
10
mm/mmap.c
10
mm/mmap.c
@@ -2204,9 +2204,8 @@ find_extend_vma(struct mm_struct *mm, unsigned long addr)
|
||||
return vma;
|
||||
if (!prev || expand_stack(prev, addr))
|
||||
return NULL;
|
||||
if (prev->vm_flags & VM_LOCKED) {
|
||||
mlock_vma_pages_range(prev, addr, prev->vm_end);
|
||||
}
|
||||
if (prev->vm_flags & VM_LOCKED)
|
||||
__mlock_vma_pages_range(prev, addr, prev->vm_end, NULL);
|
||||
return prev;
|
||||
}
|
||||
#else
|
||||
@@ -2232,9 +2231,8 @@ find_extend_vma(struct mm_struct * mm, unsigned long addr)
|
||||
start = vma->vm_start;
|
||||
if (expand_stack(vma, addr))
|
||||
return NULL;
|
||||
if (vma->vm_flags & VM_LOCKED) {
|
||||
mlock_vma_pages_range(vma, addr, start);
|
||||
}
|
||||
if (vma->vm_flags & VM_LOCKED)
|
||||
__mlock_vma_pages_range(vma, addr, start, NULL);
|
||||
return vma;
|
||||
}
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user