linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH V2] MCE: fix an error of mce_bad_pages statistics
@ 2012-12-07  8:48 Xishi Qiu
  2012-12-07 14:33 ` Borislav Petkov
  2012-12-07 22:11 ` Andrew Morton
  0 siblings, 2 replies; 38+ messages in thread
From: Xishi Qiu @ 2012-12-07  8:48 UTC (permalink / raw)
  To: WuJianguo, Xishi Qiu, Liujiang, Vyacheslav.Dubeyko,
	Borislav Petkov, andi, akpm, linux-mm, linux-kernel

On x86 platform, if we use "/sys/devices/system/memory/soft_offline_page" to offline a
free page twice, the value of mce_bad_pages will be added twice. So this is an error,
since the page was already marked HWPoison, we should skip the page and don't add the
value of mce_bad_pages.

$ cat /proc/meminfo | grep HardwareCorrupted

soft_offline_page()
	get_any_page()
		atomic_long_add(1, &mce_bad_pages)

Signed-off-by: Xishi Qiu <qiuxishi@huawei.com>
i>>?Signed-off-by: Jiang Liu <jiang.liu@huawei.com>
---
 mm/memory-failure.c |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/mm/memory-failure.c b/mm/memory-failure.c
index 8b20278..de760ca 100644
--- a/mm/memory-failure.c
+++ b/mm/memory-failure.c
@@ -1582,8 +1582,11 @@ int soft_offline_page(struct page *page, int flags)
 		return ret;

 done:
-	atomic_long_add(1, &mce_bad_pages);
-	SetPageHWPoison(page);
 	/* keep elevated page count for bad page */
+	if (!PageHWPoison(page)) {
+		atomic_long_add(1, &mce_bad_pages);
+		SetPageHWPoison(page);
+	}
+
 	return ret;
 }
-- 
1.7.6.1


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

^ permalink raw reply related	[flat|nested] 38+ messages in thread

end of thread, other threads:[~2012-12-11  8:03 UTC | newest]

Thread overview: 38+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-12-07  8:48 [PATCH V2] MCE: fix an error of mce_bad_pages statistics Xishi Qiu
2012-12-07 14:33 ` Borislav Petkov
2012-12-07 22:11 ` Andrew Morton
2012-12-07 22:41   ` Borislav Petkov
2012-12-10  4:33   ` Xishi Qiu
2012-12-10  8:33   ` Wanpeng Li
2012-12-10  9:06     ` Xishi Qiu
2012-12-10 10:47       ` Simon Jeons
2012-12-10 11:16         ` Xishi Qiu
2012-12-10 11:39           ` Wanpeng Li
2012-12-10 11:39           ` Wanpeng Li
2012-12-10 11:54             ` Xishi Qiu
2012-12-10 12:11               ` Borislav Petkov
2012-12-10 15:39             ` Andi Kleen
2012-12-10 11:58           ` Simon Jeons
     [not found]           ` <1355140561.1821.5.camel@kernel.cn.ibm.com>
     [not found]             ` <50C5D844.8050707@huawei.com>
2012-12-10 12:47               ` Simon Jeons
2012-12-11  1:16                 ` Wanpeng Li
2012-12-11  6:49                   ` Xishi Qiu
2012-12-11  8:02                     ` Wanpeng Li
2012-12-11  8:02                     ` Wanpeng Li
2012-12-11  1:16                 ` Wanpeng Li
2012-12-10 15:38           ` Andi Kleen
2012-12-11  1:49             ` Simon Jeons
2012-12-11  2:03               ` Andi Kleen
2012-12-11  2:14                 ` Simon Jeons
2012-12-11  3:01                   ` Andi Kleen
2012-12-11  3:13                     ` Simon Jeons
2012-12-11  3:19                       ` Andi Kleen
2012-12-11  3:48                         ` Simon Jeons
2012-12-11  5:55                           ` Xishi Qiu
2012-12-11  6:34                             ` Wanpeng Li
2012-12-11  6:34                             ` Wanpeng Li
2012-12-11  2:25             ` Xishi Qiu
2012-12-11  2:45               ` Fengguang Wu
2012-12-11  2:58                 ` Andi Kleen
2012-12-11  3:25                   ` Xishi Qiu
2012-12-11  3:36                     ` Andi Kleen
2012-12-10  8:33   ` Wanpeng Li

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