提交 293c07e3 编写于 作者: X Xishi Qiu 提交者: Linus Torvalds

memory-failure: use num_poisoned_pages instead of mce_bad_pages

Since MCE is an x86 concept, and this code is in mm/, it would be better
to use the name num_poisoned_pages instead of mce_bad_pages.

[akpm@linux-foundation.org: fix mm/sparse.c]
Signed-off-by: NXishi Qiu <qiuxishi@huawei.com>
Signed-off-by: NJiang Liu <jiang.liu@huawei.com>
Suggested-by: NBorislav Petkov <bp@alien8.de>
Reviewed-by: NWanpeng Li <liwanp@linux.vnet.ibm.com>
Cc: Andi Kleen <andi@firstfloor.org>
Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
上级 fa8dd8a9
...@@ -158,7 +158,7 @@ static int meminfo_proc_show(struct seq_file *m, void *v) ...@@ -158,7 +158,7 @@ static int meminfo_proc_show(struct seq_file *m, void *v)
vmi.used >> 10, vmi.used >> 10,
vmi.largest_chunk >> 10 vmi.largest_chunk >> 10
#ifdef CONFIG_MEMORY_FAILURE #ifdef CONFIG_MEMORY_FAILURE
,atomic_long_read(&mce_bad_pages) << (PAGE_SHIFT - 10) ,atomic_long_read(&num_poisoned_pages) << (PAGE_SHIFT - 10)
#endif #endif
#ifdef CONFIG_TRANSPARENT_HUGEPAGE #ifdef CONFIG_TRANSPARENT_HUGEPAGE
,K(global_page_state(NR_ANON_TRANSPARENT_HUGEPAGES) * ,K(global_page_state(NR_ANON_TRANSPARENT_HUGEPAGES) *
......
...@@ -1753,7 +1753,7 @@ extern int unpoison_memory(unsigned long pfn); ...@@ -1753,7 +1753,7 @@ extern int unpoison_memory(unsigned long pfn);
extern int sysctl_memory_failure_early_kill; extern int sysctl_memory_failure_early_kill;
extern int sysctl_memory_failure_recovery; extern int sysctl_memory_failure_recovery;
extern void shake_page(struct page *p, int access); extern void shake_page(struct page *p, int access);
extern atomic_long_t mce_bad_pages; extern atomic_long_t num_poisoned_pages;
extern int soft_offline_page(struct page *page, int flags); extern int soft_offline_page(struct page *page, int flags);
extern void dump_page(struct page *page); extern void dump_page(struct page *page);
......
...@@ -61,7 +61,7 @@ int sysctl_memory_failure_early_kill __read_mostly = 0; ...@@ -61,7 +61,7 @@ int sysctl_memory_failure_early_kill __read_mostly = 0;
int sysctl_memory_failure_recovery __read_mostly = 1; int sysctl_memory_failure_recovery __read_mostly = 1;
atomic_long_t mce_bad_pages __read_mostly = ATOMIC_LONG_INIT(0); atomic_long_t num_poisoned_pages __read_mostly = ATOMIC_LONG_INIT(0);
#if defined(CONFIG_HWPOISON_INJECT) || defined(CONFIG_HWPOISON_INJECT_MODULE) #if defined(CONFIG_HWPOISON_INJECT) || defined(CONFIG_HWPOISON_INJECT_MODULE)
...@@ -1040,7 +1040,7 @@ int memory_failure(unsigned long pfn, int trapno, int flags) ...@@ -1040,7 +1040,7 @@ int memory_failure(unsigned long pfn, int trapno, int flags)
} }
nr_pages = 1 << compound_trans_order(hpage); nr_pages = 1 << compound_trans_order(hpage);
atomic_long_add(nr_pages, &mce_bad_pages); atomic_long_add(nr_pages, &num_poisoned_pages);
/* /*
* We need/can do nothing about count=0 pages. * We need/can do nothing about count=0 pages.
...@@ -1070,7 +1070,7 @@ int memory_failure(unsigned long pfn, int trapno, int flags) ...@@ -1070,7 +1070,7 @@ int memory_failure(unsigned long pfn, int trapno, int flags)
if (!PageHWPoison(hpage) if (!PageHWPoison(hpage)
|| (hwpoison_filter(p) && TestClearPageHWPoison(p)) || (hwpoison_filter(p) && TestClearPageHWPoison(p))
|| (p != hpage && TestSetPageHWPoison(hpage))) { || (p != hpage && TestSetPageHWPoison(hpage))) {
atomic_long_sub(nr_pages, &mce_bad_pages); atomic_long_sub(nr_pages, &num_poisoned_pages);
return 0; return 0;
} }
set_page_hwpoison_huge_page(hpage); set_page_hwpoison_huge_page(hpage);
...@@ -1128,7 +1128,7 @@ int memory_failure(unsigned long pfn, int trapno, int flags) ...@@ -1128,7 +1128,7 @@ int memory_failure(unsigned long pfn, int trapno, int flags)
} }
if (hwpoison_filter(p)) { if (hwpoison_filter(p)) {
if (TestClearPageHWPoison(p)) if (TestClearPageHWPoison(p))
atomic_long_sub(nr_pages, &mce_bad_pages); atomic_long_sub(nr_pages, &num_poisoned_pages);
unlock_page(hpage); unlock_page(hpage);
put_page(hpage); put_page(hpage);
return 0; return 0;
...@@ -1323,7 +1323,7 @@ int unpoison_memory(unsigned long pfn) ...@@ -1323,7 +1323,7 @@ int unpoison_memory(unsigned long pfn)
return 0; return 0;
} }
if (TestClearPageHWPoison(p)) if (TestClearPageHWPoison(p))
atomic_long_sub(nr_pages, &mce_bad_pages); atomic_long_sub(nr_pages, &num_poisoned_pages);
pr_info("MCE: Software-unpoisoned free page %#lx\n", pfn); pr_info("MCE: Software-unpoisoned free page %#lx\n", pfn);
return 0; return 0;
} }
...@@ -1337,7 +1337,7 @@ int unpoison_memory(unsigned long pfn) ...@@ -1337,7 +1337,7 @@ int unpoison_memory(unsigned long pfn)
*/ */
if (TestClearPageHWPoison(page)) { if (TestClearPageHWPoison(page)) {
pr_info("MCE: Software-unpoisoned page %#lx\n", pfn); pr_info("MCE: Software-unpoisoned page %#lx\n", pfn);
atomic_long_sub(nr_pages, &mce_bad_pages); atomic_long_sub(nr_pages, &num_poisoned_pages);
freeit = 1; freeit = 1;
if (PageHuge(page)) if (PageHuge(page))
clear_page_hwpoison_huge_page(page); clear_page_hwpoison_huge_page(page);
...@@ -1442,7 +1442,7 @@ static int soft_offline_huge_page(struct page *page, int flags) ...@@ -1442,7 +1442,7 @@ static int soft_offline_huge_page(struct page *page, int flags)
} }
done: done:
/* keep elevated page count for bad page */ /* keep elevated page count for bad page */
atomic_long_add(1 << compound_trans_order(hpage), &mce_bad_pages); atomic_long_add(1 << compound_trans_order(hpage), &num_poisoned_pages);
set_page_hwpoison_huge_page(hpage); set_page_hwpoison_huge_page(hpage);
dequeue_hwpoisoned_huge_page(hpage); dequeue_hwpoisoned_huge_page(hpage);
out: out:
...@@ -1585,7 +1585,7 @@ int soft_offline_page(struct page *page, int flags) ...@@ -1585,7 +1585,7 @@ int soft_offline_page(struct page *page, int flags)
done: done:
/* keep elevated page count for bad page */ /* keep elevated page count for bad page */
atomic_long_inc(&mce_bad_pages); atomic_long_inc(&num_poisoned_pages);
SetPageHWPoison(page); SetPageHWPoison(page);
out: out:
return ret; return ret;
......
...@@ -783,7 +783,7 @@ static void clear_hwpoisoned_pages(struct page *memmap, int nr_pages) ...@@ -783,7 +783,7 @@ static void clear_hwpoisoned_pages(struct page *memmap, int nr_pages)
for (i = 0; i < PAGES_PER_SECTION; i++) { for (i = 0; i < PAGES_PER_SECTION; i++) {
if (PageHWPoison(&memmap[i])) { if (PageHWPoison(&memmap[i])) {
atomic_long_sub(1, &mce_bad_pages); atomic_long_sub(1, &num_poisoned_pages);
ClearPageHWPoison(&memmap[i]); ClearPageHWPoison(&memmap[i]);
} }
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册