diff options
Diffstat (limited to 'mm/mlock.c')
-rw-r--r-- | mm/mlock.c | 41 |
1 files changed, 36 insertions, 5 deletions
diff --git a/mm/mlock.c b/mm/mlock.c index 8b478350a2a1..bce1b22c36c2 100644 --- a/mm/mlock.c +++ b/mm/mlock.c | |||
@@ -60,6 +60,8 @@ void __clear_page_mlock(struct page *page) | |||
60 | return; | 60 | return; |
61 | } | 61 | } |
62 | 62 | ||
63 | dec_zone_page_state(page, NR_MLOCK); | ||
64 | count_vm_event(UNEVICTABLE_PGCLEARED); | ||
63 | if (!isolate_lru_page(page)) { | 65 | if (!isolate_lru_page(page)) { |
64 | putback_lru_page(page); | 66 | putback_lru_page(page); |
65 | } else { | 67 | } else { |
@@ -69,6 +71,9 @@ void __clear_page_mlock(struct page *page) | |||
69 | lru_add_drain_all(); | 71 | lru_add_drain_all(); |
70 | if (!isolate_lru_page(page)) | 72 | if (!isolate_lru_page(page)) |
71 | putback_lru_page(page); | 73 | putback_lru_page(page); |
74 | else if (PageUnevictable(page)) | ||
75 | count_vm_event(UNEVICTABLE_PGSTRANDED); | ||
76 | |||
72 | } | 77 | } |
73 | } | 78 | } |
74 | 79 | ||
@@ -80,8 +85,12 @@ void mlock_vma_page(struct page *page) | |||
80 | { | 85 | { |
81 | BUG_ON(!PageLocked(page)); | 86 | BUG_ON(!PageLocked(page)); |
82 | 87 | ||
83 | if (!TestSetPageMlocked(page) && !isolate_lru_page(page)) | 88 | if (!TestSetPageMlocked(page)) { |
84 | putback_lru_page(page); | 89 | inc_zone_page_state(page, NR_MLOCK); |
90 | count_vm_event(UNEVICTABLE_PGMLOCKED); | ||
91 | if (!isolate_lru_page(page)) | ||
92 | putback_lru_page(page); | ||
93 | } | ||
85 | } | 94 | } |
86 | 95 | ||
87 | /* | 96 | /* |
@@ -106,9 +115,31 @@ static void munlock_vma_page(struct page *page) | |||
106 | { | 115 | { |
107 | BUG_ON(!PageLocked(page)); | 116 | BUG_ON(!PageLocked(page)); |
108 | 117 | ||
109 | if (TestClearPageMlocked(page) && !isolate_lru_page(page)) { | 118 | if (TestClearPageMlocked(page)) { |
110 | try_to_munlock(page); | 119 | dec_zone_page_state(page, NR_MLOCK); |
111 | putback_lru_page(page); | 120 | if (!isolate_lru_page(page)) { |
121 | int ret = try_to_munlock(page); | ||
122 | /* | ||
123 | * did try_to_unlock() succeed or punt? | ||
124 | */ | ||
125 | if (ret == SWAP_SUCCESS || ret == SWAP_AGAIN) | ||
126 | count_vm_event(UNEVICTABLE_PGMUNLOCKED); | ||
127 | |||
128 | putback_lru_page(page); | ||
129 | } else { | ||
130 | /* | ||
131 | * We lost the race. let try_to_unmap() deal | ||
132 | * with it. At least we get the page state and | ||
133 | * mlock stats right. However, page is still on | ||
134 | * the noreclaim list. We'll fix that up when | ||
135 | * the page is eventually freed or we scan the | ||
136 | * noreclaim list. | ||
137 | */ | ||
138 | if (PageUnevictable(page)) | ||
139 | count_vm_event(UNEVICTABLE_PGSTRANDED); | ||
140 | else | ||
141 | count_vm_event(UNEVICTABLE_PGMUNLOCKED); | ||
142 | } | ||
112 | } | 143 | } |
113 | } | 144 | } |
114 | 145 | ||