From: Minchan Kim <minchan@kernel.org>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Rik van Riel <riel@redhat.com>, Mel Gorman <mgorman@suse.de>,
Hugh Dickins <hughd@google.com>,
Dave Hansen <dave.hansen@intel.com>,
Johannes Weiner <hannes@cmpxchg.org>,
KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>,
linux-mm@kvack.org, linux-kernel@vger.kernel.org,
John Stultz <john.stultz@linaro.org>, Jason Evans <je@fb.com>,
Minchan Kim <minchan@kernel.org>
Subject: [RFC 6/6] mm: ksm: don't merge lazyfree page
Date: Fri, 14 Mar 2014 15:37:50 +0900 [thread overview]
Message-ID: <1394779070-8545-7-git-send-email-minchan@kernel.org> (raw)
In-Reply-To: <1394779070-8545-1-git-send-email-minchan@kernel.org>
I didn't test this patch but just wanted to make lagefree pages KSM.
Signed-off-by: Minchan Kim <minchan@kernel.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, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
next prev parent reply other threads:[~2014-03-14 6:37 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-03-14 6:37 [RFC 0/6] mm: support madvise(MADV_FREE) Minchan Kim
2014-03-14 6:37 ` [RFC 1/6] mm: clean up PAGE_MAPPING_FLAGS Minchan Kim
2014-03-14 6:37 ` [RFC 2/6] mm: work deactivate_page with anon pages Minchan Kim
2014-03-14 6:37 ` [RFC 3/6] mm: support madvise(MADV_FREE) Minchan Kim
2014-03-14 7:49 ` Minchan Kim
2014-03-14 13:33 ` Kirill A. Shutemov
2014-03-14 15:24 ` Minchan Kim
2014-03-18 18:26 ` Johannes Weiner
2014-03-19 1:22 ` Minchan Kim
2014-03-14 6:37 ` [RFC 4/6] mm: add stat about lazyfree pages Minchan Kim
2014-03-14 6:37 ` [RFC 5/6] mm: reclaim lazyfree pages in swapless system Minchan Kim
2014-03-14 6:37 ` Minchan Kim [this message]
2014-03-14 7:37 ` [RFC 0/6] mm: support madvise(MADV_FREE) Zhang Yanfei
2014-03-14 7:56 ` Minchan Kim
2014-03-18 17:55 ` Andy Lutomirski
2014-03-19 0:18 ` Minchan Kim
2014-03-19 0:23 ` Andy Lutomirski
2014-03-19 1:02 ` Minchan Kim
2014-03-19 5:15 ` Johannes Weiner
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1394779070-8545-7-git-send-email-minchan@kernel.org \
--to=minchan@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=dave.hansen@intel.com \
--cc=hannes@cmpxchg.org \
--cc=hughd@google.com \
--cc=je@fb.com \
--cc=john.stultz@linaro.org \
--cc=kosaki.motohiro@jp.fujitsu.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mgorman@suse.de \
--cc=riel@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).