[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1394779070-8545-7-git-send-email-minchan@kernel.org>
Date: Fri, 14 Mar 2014 15:37:50 +0900
From: Minchan Kim <minchan@...nel.org>
To: Andrew Morton <akpm@...ux-foundation.org>
Cc: Rik van Riel <riel@...hat.com>, Mel Gorman <mgorman@...e.de>,
Hugh Dickins <hughd@...gle.com>,
Dave Hansen <dave.hansen@...el.com>,
Johannes Weiner <hannes@...xchg.org>,
KOSAKI Motohiro <kosaki.motohiro@...fujitsu.com>,
linux-mm@...ck.org, linux-kernel@...r.kernel.org,
John Stultz <john.stultz@...aro.org>, Jason Evans <je@...com>,
Minchan Kim <minchan@...nel.org>
Subject: [RFC 6/6] mm: ksm: don't merge lazyfree page
I didn't test this patch but just wanted to make lagefree pages KSM.
Signed-off-by: Minchan Kim <minchan@...nel.org>
---
mm/ksm.c | 18 +++++++++++++-----
1 file changed, 13 insertions(+), 5 deletions(-)
diff --git a/mm/ksm.c b/mm/ksm.c
index 68710e80994a..43ca73aa45e7 100644
--- a/mm/ksm.c
+++ b/mm/ksm.c
@@ -470,7 +470,8 @@ static struct page *get_mergeable_page(struct rmap_item *rmap_item)
page = follow_page(vma, addr, FOLL_GET);
if (IS_ERR_OR_NULL(page))
goto out;
- if (PageAnon(page) || page_trans_compound_anon(page)) {
+ if ((PageAnon(page) && !PageLazyFree(page)) ||
+ page_trans_compound_anon(page)) {
flush_anon_page(vma, page, addr);
flush_dcache_page(page);
} else {
@@ -1032,13 +1033,20 @@ static int try_to_merge_one_page(struct vm_area_struct *vma,
/*
* We need the page lock to read a stable PageSwapCache in
- * write_protect_page(). We use trylock_page() instead of
- * lock_page() because we don't want to wait here - we
- * prefer to continue scanning and merging different pages,
+ * write_protect_page() and check lazyfree.
+ * We use trylock_page() instead of lock_page() because we
+ * don't want to wait here - we prefer to continue scanning
+ * and merging different pages,
* then come back to this page when it is unlocked.
*/
if (!trylock_page(page))
goto out;
+
+ if (PageLazyFree(page)) {
+ unlock_page(page);
+ goto out;
+ }
+
/*
* If this anonymous page is mapped only here, its pte may need
* to be write-protected. If it's mapped elsewhere, all of its
@@ -1621,7 +1629,7 @@ next_mm:
cond_resched();
continue;
}
- if (PageAnon(*page) ||
+ if ((PageAnon(*page) && !PageLazyFree(*page)) ||
page_trans_compound_anon(*page)) {
flush_anon_page(vma, *page, ksm_scan.address);
flush_dcache_page(*page);
--
1.9.0
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists