diff options
author | Michel Lespinasse <walken@google.com> | 2013-02-22 19:32:44 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2013-02-23 20:50:11 -0500 |
commit | cea10a19b7972a1954c4a2d05a7de8db48b444fb (patch) | |
tree | 694b3c906259cfbfc7b7cb1b0eb507ecf0d1d63c /mm/mmap.c | |
parent | c22c0d6344c362b1dde5d8e160d3d07536aca120 (diff) |
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>
Diffstat (limited to 'mm/mmap.c')
-rw-r--r-- | mm/mmap.c | 10 |
1 files changed, 4 insertions, 6 deletions
@@ -2204,9 +2204,8 @@ find_extend_vma(struct mm_struct *mm, unsigned long addr) | |||
2204 | return vma; | 2204 | return vma; |
2205 | if (!prev || expand_stack(prev, addr)) | 2205 | if (!prev || expand_stack(prev, addr)) |
2206 | return NULL; | 2206 | return NULL; |
2207 | if (prev->vm_flags & VM_LOCKED) { | 2207 | if (prev->vm_flags & VM_LOCKED) |
2208 | mlock_vma_pages_range(prev, addr, prev->vm_end); | 2208 | __mlock_vma_pages_range(prev, addr, prev->vm_end, NULL); |
2209 | } | ||
2210 | return prev; | 2209 | return prev; |
2211 | } | 2210 | } |
2212 | #else | 2211 | #else |
@@ -2232,9 +2231,8 @@ find_extend_vma(struct mm_struct * mm, unsigned long addr) | |||
2232 | start = vma->vm_start; | 2231 | start = vma->vm_start; |
2233 | if (expand_stack(vma, addr)) | 2232 | if (expand_stack(vma, addr)) |
2234 | return NULL; | 2233 | return NULL; |
2235 | if (vma->vm_flags & VM_LOCKED) { | 2234 | if (vma->vm_flags & VM_LOCKED) |
2236 | mlock_vma_pages_range(vma, addr, start); | 2235 | __mlock_vma_pages_range(vma, addr, start, NULL); |
2237 | } | ||
2238 | return vma; | 2236 | return vma; |
2239 | } | 2237 | } |
2240 | #endif | 2238 | #endif |