diff options
Diffstat (limited to 'mm/memory.c')
-rw-r--r-- | mm/memory.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/mm/memory.c b/mm/memory.c index 607098d47e74..27f425378112 100644 --- a/mm/memory.c +++ b/mm/memory.c | |||
@@ -1359,7 +1359,7 @@ split_fallthrough: | |||
1359 | */ | 1359 | */ |
1360 | mark_page_accessed(page); | 1360 | mark_page_accessed(page); |
1361 | } | 1361 | } |
1362 | if (flags & FOLL_MLOCK) { | 1362 | if ((flags & FOLL_MLOCK) && (vma->vm_flags & VM_LOCKED)) { |
1363 | /* | 1363 | /* |
1364 | * The preliminary mapping check is mainly to avoid the | 1364 | * The preliminary mapping check is mainly to avoid the |
1365 | * pointless overhead of lock_page on the ZERO_PAGE | 1365 | * pointless overhead of lock_page on the ZERO_PAGE |
@@ -1552,10 +1552,9 @@ int __get_user_pages(struct task_struct *tsk, struct mm_struct *mm, | |||
1552 | } | 1552 | } |
1553 | 1553 | ||
1554 | /* | 1554 | /* |
1555 | * If we don't actually want the page itself, | 1555 | * For mlock, just skip the stack guard page. |
1556 | * and it's the stack guard page, just skip it. | ||
1557 | */ | 1556 | */ |
1558 | if (!pages && stack_guard_page(vma, start)) | 1557 | if ((gup_flags & FOLL_MLOCK) && stack_guard_page(vma, start)) |
1559 | goto next_page; | 1558 | goto next_page; |
1560 | 1559 | ||
1561 | do { | 1560 | do { |