path: root/mm/mlock.c
diff options
authorHugh Dickins <>2009-12-14 17:58:58 -0800
committerLinus Torvalds <>2009-12-15 08:53:17 -0800
commit53f79acb6ecb648afd63e0f13deba167f1a934df (patch)
tree48d9b998fa45c4fe510447d17cdc050f31be5e23 /mm/mlock.c
parent3ca7b3c5b64d35fe02c35b5d44c2c58b49499fee (diff)
mm: mlocking in try_to_unmap_one
There's contorted mlock/munlock handling in try_to_unmap_anon() and try_to_unmap_file(), which we'd prefer not to repeat for KSM swapping. Simplify it by moving it all down into try_to_unmap_one(). One thing is then lost, try_to_munlock()'s distinction between when no vma holds the page mlocked, and when a vma does mlock it, but we could not get mmap_sem to set the page flag. But its only caller takes no interest in that distinction (and is better testing SWAP_MLOCK anyway), so let's keep the code simple and return SWAP_AGAIN for both cases. try_to_unmap_file()'s TTU_MUNLOCK nonlinear handling was particularly amusing: once unravelled, it turns out to have been choosing between two different ways of doing the same nothing. Ah, no, one way was actually returning SWAP_FAIL when it meant to return SWAP_SUCCESS. [ comment adding to mlocking in try_to_unmap_one] [ remove test of MLOCK_PAGES] Signed-off-by: Hugh Dickins <> Cc: Izik Eidus <> Cc: Andrea Arcangeli <> Cc: Nick Piggin <> Cc: Rik van Riel <> Cc: Lee Schermerhorn <> Cc: Andi Kleen <> Cc: KAMEZAWA Hiroyuki <> Cc: Wu Fengguang <> Cc: Minchan Kim <> Signed-off-by: KOSAKI Motohiro <> Cc: Andi Kleen <> Signed-off-by: Andrew Morton <> Signed-off-by: Linus Torvalds <>
Diffstat (limited to 'mm/mlock.c')
1 files changed, 1 insertions, 1 deletions
diff --git a/mm/mlock.c b/mm/mlock.c
index bd6f0e466f6c..48691fb08514 100644
--- a/mm/mlock.c
+++ b/mm/mlock.c
@@ -117,7 +117,7 @@ static void munlock_vma_page(struct page *page)
* did try_to_unlock() succeed or punt?
- if (ret == SWAP_SUCCESS || ret == SWAP_AGAIN)
+ if (ret != SWAP_MLOCK)