Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1422486

[PATCH v2] more mapcount page as kpage could reduce total replacement times than fewer mapcount one in probability.

From <zhouxianrong@huawei.com>
Newsgroups linux.kernel
Subject [PATCH v2] more mapcount page as kpage could reduce total replacement times than fewer mapcount one in probability.
Date 2016-06-15 04:10 +0200
Message-ID <rK8rf-4F5-3@gated-at.bofh.it> (permalink)
Organization linux.* mail to news gateway

Show all headers | View raw


From: z00281421 <z00281421@notesmail.huawei.com>

more mapcount page as kpage could reduce total replacement times 
than fewer mapcount one when ksmd scan and replace among 
forked pages later.

Signed-off-by: z00281421 <z00281421@notesmail.huawei.com>
---
 mm/ksm.c |    8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/mm/ksm.c b/mm/ksm.c
index 4786b41..4d530af 100644
--- a/mm/ksm.c
+++ b/mm/ksm.c
@@ -1094,6 +1094,14 @@ static struct page *try_to_merge_two_pages(struct rmap_item *rmap_item,
 {
 	int err;
 
+	/*
+	 * select more mapcount page as kpage
+	 */
+	if (page_mapcount(page) < page_mapcount(tree_page)) {
+		swap(page, tree_page);
+		swap(rmap_item, tree_rmap_item);
+	}
+
 	err = try_to_merge_with_ksm_page(rmap_item, page, NULL);
 	if (!err) {
 		err = try_to_merge_with_ksm_page(tree_rmap_item,
-- 
1.7.9.5

Back to linux.kernel | Previous | NextNext in thread | Find similar | Unroll thread


Thread

[PATCH v2] more mapcount page as kpage could reduce total replacement times than fewer mapcount one in probability. <zhouxianrong@huawei.com> - 2016-06-15 04:10 +0200
  Re: [PATCH v2] more mapcount page as kpage could reduce total  replacement times than fewer mapcount one in probability. zhouxianrong <zhouxianrong@huawei.com> - 2016-06-21 04:10 +0200
    Re: [PATCH v2] more mapcount page as kpage could reduce total  replacement times than fewer mapcount one in probability. Hugh Dickins <hughd@google.com> - 2016-06-22 03:40 +0200
      Re: [PATCH v2] more mapcount page as kpage could reduce total  replacement times than fewer mapcount one in probability. zhouxianrong <zhouxianrong@huawei.com> - 2016-06-22 13:10 +0200

csiph-web