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-prev] [thread-next>] [day] [month] [year] [list]
Date:	Thu, 4 Jun 2015 20:59:28 +0800
From:	Xishi Qiu <qiuxishi@...wei.com>
To:	Xishi Qiu <qiuxishi@...wei.com>,
	Andrew Morton <akpm@...ux-foundation.org>,
	<nao.horiguchi@...il.com>, Yinghai Lu <yinghai@...nel.org>,
	"H. Peter Anvin" <hpa@...or.com>,
	Thomas Gleixner <tglx@...utronix.de>, <mingo@...e.hu>,
	Xiexiuqi <xiexiuqi@...wei.com>,
	Hanjun Guo <guohanjun@...wei.com>,
	"Luck, Tony" <tony.luck@...el.com>
CC:	Linux MM <linux-mm@...ck.org>, LKML <linux-kernel@...r.kernel.org>
Subject: [RFC PATCH 04/12] mm: add mirrored pages to buddy system

Set mirrored pageblock's migratetype to MIGRATE_MIRROR, so they could free to
buddy system's MIGRATE_MIRROR list when free bootmem.

Signed-off-by: Xishi Qiu <qiuxishi@...wei.com>
---
 mm/page_alloc.c | 27 +++++++++++++++++++++++++++
 1 file changed, 27 insertions(+)

diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 3b2ff46..8fe0187 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -572,6 +572,25 @@ static void __init print_mirror_info(void)
 			mirror_info.info[i].start +
 				mirror_info.info[i].size - 1);
 }
+
+static inline bool is_mirror_pfn(unsigned long pfn)
+{
+	int i;
+	unsigned long addr = pfn << PAGE_SHIFT;
+
+	/* 0-4G is always mirrored, so ignore it */
+	if (addr < (4UL << 30))
+		return false;
+
+	for (i = 0; i < mirror_info.count; i++) {
+		if (addr >= mirror_info.info[i].start &&
+		    addr < mirror_info.info[i].start +
+			   mirror_info.info[i].size)
+			return true;
+	}
+
+	return false;
+}
 #endif
 
 /*
@@ -4147,6 +4166,9 @@ static void setup_zone_migrate_reserve(struct zone *zone)
 
 		block_migratetype = get_pageblock_migratetype(page);
 
+		if (is_migrate_mirror(block_migratetype))
+			continue;
+
 		/* Only test what is necessary when the reserves are not met */
 		if (reserve > 0) {
 			/*
@@ -4246,6 +4268,11 @@ void __meminit memmap_init_zone(unsigned long size, int nid, unsigned long zone,
 		    && !(pfn & (pageblock_nr_pages - 1)))
 			set_pageblock_migratetype(page, MIGRATE_MOVABLE);
 
+#ifdef CONFIG_MEMORY_MIRROR
+		if (is_mirror_pfn(pfn))
+			set_pageblock_migratetype(page, MIGRATE_MIRROR);
+#endif
+
 		INIT_LIST_HEAD(&page->lru);
 #ifdef WANT_PAGE_VIRTUAL
 		/* The shift won't overflow because ZONE_NORMAL is below 4G. */
-- 
2.0.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

Powered by Openwall GNU/*/Linux Powered by OpenVZ