lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <1465955818-101898-1-git-send-email-zhouxianrong@huawei.com>
Date:	Wed, 15 Jun 2016 09:56:58 +0800
From:	<zhouxianrong@...wei.com>
To:	<linux-mm@...ck.org>
CC:	<akpm@...ux-foundation.org>, <hughd@...gle.com>,
	<aarcange@...hat.com>, <kirill.shutemov@...ux.intel.com>,
	<dave.hansen@...ux.intel.com>, <zhouchengming1@...wei.com>,
	<geliangtang@....com>, <zhouxianrong@...wei.com>,
	<linux-kernel@...r.kernel.org>, <zhouxiyu@...wei.com>,
	<wanghaijun5@...wei.com>
Subject: [PATCH v2] more mapcount page as kpage could reduce total replacement times than fewer mapcount one in probability.

From: z00281421 <z00281421@...esmail.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@...esmail.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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ