diff options
Diffstat (limited to 'mm/mlock.c')
-rw-r--r-- | mm/mlock.c | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/mm/mlock.c b/mm/mlock.c index 048260c4e02e..4f4f53bdc65d 100644 --- a/mm/mlock.c +++ b/mm/mlock.c | |||
@@ -14,7 +14,7 @@ | |||
14 | #include <linux/mempolicy.h> | 14 | #include <linux/mempolicy.h> |
15 | #include <linux/syscalls.h> | 15 | #include <linux/syscalls.h> |
16 | #include <linux/sched.h> | 16 | #include <linux/sched.h> |
17 | #include <linux/module.h> | 17 | #include <linux/export.h> |
18 | #include <linux/rmap.h> | 18 | #include <linux/rmap.h> |
19 | #include <linux/mmzone.h> | 19 | #include <linux/mmzone.h> |
20 | #include <linux/hugetlb.h> | 20 | #include <linux/hugetlb.h> |
@@ -110,7 +110,15 @@ void munlock_vma_page(struct page *page) | |||
110 | if (TestClearPageMlocked(page)) { | 110 | if (TestClearPageMlocked(page)) { |
111 | dec_zone_page_state(page, NR_MLOCK); | 111 | dec_zone_page_state(page, NR_MLOCK); |
112 | if (!isolate_lru_page(page)) { | 112 | if (!isolate_lru_page(page)) { |
113 | int ret = try_to_munlock(page); | 113 | int ret = SWAP_AGAIN; |
114 | |||
115 | /* | ||
116 | * Optimization: if the page was mapped just once, | ||
117 | * that's our mapping and we don't need to check all the | ||
118 | * other vmas. | ||
119 | */ | ||
120 | if (page_mapcount(page) > 1) | ||
121 | ret = try_to_munlock(page); | ||
114 | /* | 122 | /* |
115 | * did try_to_unlock() succeed or punt? | 123 | * did try_to_unlock() succeed or punt? |
116 | */ | 124 | */ |
@@ -549,7 +557,8 @@ SYSCALL_DEFINE1(mlockall, int, flags) | |||
549 | if (!can_do_mlock()) | 557 | if (!can_do_mlock()) |
550 | goto out; | 558 | goto out; |
551 | 559 | ||
552 | lru_add_drain_all(); /* flush pagevec */ | 560 | if (flags & MCL_CURRENT) |
561 | lru_add_drain_all(); /* flush pagevec */ | ||
553 | 562 | ||
554 | down_write(¤t->mm->mmap_sem); | 563 | down_write(¤t->mm->mmap_sem); |
555 | 564 | ||