aboutsummaryrefslogtreecommitdiffstats
path: root/mm/mlock.c
diff options
context:
space:
mode:
authorThomas Gleixner <tglx@linutronix.de>2010-10-12 11:27:20 -0400
committerThomas Gleixner <tglx@linutronix.de>2010-10-12 11:27:28 -0400
commit37eca0d64a2dbeece25969ec0698e1ff72bdcf39 (patch)
tree54ba70f0428f586f4fe28d8b429b9f9e0799a17a /mm/mlock.c
parent277b199800ac90811ac86d215063df1984f51619 (diff)
parent3c06806e690885ce978ef180c8f8b6f8c17fb4b4 (diff)
Merge branch 'linus' into core/locking
Reason: Pull in the semaphore related changes Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'mm/mlock.c')
-rw-r--r--mm/mlock.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/mm/mlock.c b/mm/mlock.c
index 49e5e4cb8232..b70919ce4f72 100644
--- a/mm/mlock.c
+++ b/mm/mlock.c
@@ -135,6 +135,13 @@ void munlock_vma_page(struct page *page)
135 } 135 }
136} 136}
137 137
138static 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
138/** 145/**
139 * __mlock_vma_pages_range() - mlock a range of pages in the vma. 146 * __mlock_vma_pages_range() - mlock a range of pages in the vma.
140 * @vma: target vma 147 * @vma: target vma
@@ -168,11 +175,9 @@ static long __mlock_vma_pages_range(struct vm_area_struct *vma,
168 gup_flags |= FOLL_WRITE; 175 gup_flags |= FOLL_WRITE;
169 176
170 /* We don't try to access the guard page of a stack vma */ 177 /* We don't try to access the guard page of a stack vma */
171 if (vma->vm_flags & VM_GROWSDOWN) { 178 if (stack_guard_page(vma, start)) {
172 if (start == vma->vm_start) { 179 addr += PAGE_SIZE;
173 start += PAGE_SIZE; 180 nr_pages--;
174 nr_pages--;
175 }
176 } 181 }
177 182
178 while (nr_pages > 0) { 183 while (nr_pages > 0) {