From 4b8708e85400f6e0c9b49c16195457fca4636b9c Mon Sep 17 00:00:00 2001 From: Hugh Dickins Date: Mon, 31 Oct 2011 17:09:43 -0700 Subject: [PATCH] --- yaml --- r: 272168 b: refs/heads/master c: 3d470fc385defa60d9af610f05db8e7f8b4f2f5e h: refs/heads/master v: v3 --- [refs] | 2 +- trunk/mm/mlock.c | 10 +++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/[refs] b/[refs] index 27f90a0c4f05..f4b62a88efa5 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 35d8c7ad7208dad5d352c483408e555022750978 +refs/heads/master: 3d470fc385defa60d9af610f05db8e7f8b4f2f5e diff --git a/trunk/mm/mlock.c b/trunk/mm/mlock.c index 7debb4fdf79b..bd34b3a10852 100644 --- a/trunk/mm/mlock.c +++ b/trunk/mm/mlock.c @@ -110,7 +110,15 @@ void munlock_vma_page(struct page *page) if (TestClearPageMlocked(page)) { dec_zone_page_state(page, NR_MLOCK); if (!isolate_lru_page(page)) { - int ret = try_to_munlock(page); + int ret = SWAP_AGAIN; + + /* + * Optimization: if the page was mapped just once, + * that's our mapping and we don't need to check all the + * other vmas. + */ + if (page_mapcount(page) > 1) + ret = try_to_munlock(page); /* * did try_to_unlock() succeed or punt? */