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: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1350629202-9664-7-git-send-email-wency@cn.fujitsu.com>
Date:	Fri, 19 Oct 2012 14:46:39 +0800
From:	wency@...fujitsu.com
To:	linux-mm@...ck.org, linux-kernel@...r.kernel.org
Cc:	rientjes@...gle.com, liuj97@...il.com, len.brown@...el.com,
	benh@...nel.crashing.org, paulus@...ba.org, minchan.kim@...il.com,
	akpm@...ux-foundation.org, kosaki.motohiro@...fujitsu.com,
	isimatu.yasuaki@...fujitsu.com,
	Wen Congyang <wency@...fujitsu.com>,
	Christoph Lameter <cl@...ux.com>
Subject: [PATCH v3 6/9] memory-hotplug: update mce_bad_pages when removing the memory

From: Wen Congyang <wency@...fujitsu.com>

When we hotremove a memory device, we will free the memory to store
struct page. If the page is hwpoisoned page, we should decrease
mce_bad_pages.

CC: David Rientjes <rientjes@...gle.com>
CC: Jiang Liu <liuj97@...il.com>
CC: Len Brown <len.brown@...el.com>
CC: Benjamin Herrenschmidt <benh@...nel.crashing.org>
CC: Paul Mackerras <paulus@...ba.org>
CC: Christoph Lameter <cl@...ux.com>
Cc: Minchan Kim <minchan.kim@...il.com>
CC: Andrew Morton <akpm@...ux-foundation.org>
CC: KOSAKI Motohiro <kosaki.motohiro@...fujitsu.com>
CC: Yasuaki Ishimatsu <isimatu.yasuaki@...fujitsu.com>
Signed-off-by: Wen Congyang <wency@...fujitsu.com>
---
 mm/sparse.c |   19 +++++++++++++++++++
 1 files changed, 19 insertions(+), 0 deletions(-)

diff --git a/mm/sparse.c b/mm/sparse.c
index 0021265..77d6a93 100644
--- a/mm/sparse.c
+++ b/mm/sparse.c
@@ -774,6 +774,24 @@ out:
 	return ret;
 }
 
+#ifdef CONFIG_MEMORY_FAILURE
+static void clear_hwpoisoned_pages(struct page *memmap, int nr_pages)
+{
+	int i;
+
+	for (i = 0; i < PAGES_PER_SECTION; i++) {
+		if (PageHWPoison(&memmap[i])) {
+			atomic_long_sub(1, &mce_bad_pages);
+			ClearPageHWPoison(&memmap[i]);
+		}
+	}
+}
+#else
+static void clear_hwpoisoned_pages(struct page *memmap, int nr_pages)
+{
+}
+#endif
+
 void sparse_remove_one_section(struct zone *zone, struct mem_section *ms)
 {
 	struct page *memmap = NULL;
@@ -785,6 +803,7 @@ void sparse_remove_one_section(struct zone *zone, struct mem_section *ms)
 						__section_nr(ms));
 		ms->section_mem_map = 0;
 		ms->pageblock_flags = NULL;
+		clear_hwpoisoned_pages(memmap, PAGES_PER_SECTION);
 	}
 
 	free_section_usemap(memmap, usemap);
-- 
1.7.1

--
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