diff options
author | Wen Congyang <wency@cn.fujitsu.com> | 2012-12-11 19:00:47 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-12-11 20:22:22 -0500 |
commit | 95a4774d055c72d96ab192a1c6675cbf4d513f71 (patch) | |
tree | 9988a8d58d2c61db0f98d98e0b4b83d74ce63d61 /mm/sparse.c | |
parent | b023f46813cde6e3b8a8c24f432ff9c1fd8e9a64 (diff) |
memory-hotplug: update mce_bad_pages when removing the memory
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.
[akpm@linux-foundation.org: cleanup ifdefs]
Signed-off-by: Wen Congyang <wency@cn.fujitsu.com>
Cc: David Rientjes <rientjes@google.com>
Cc: Jiang Liu <liuj97@gmail.com>
Cc: Len Brown <len.brown@intel.com>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Christoph Lameter <cl@linux.com>
Cc: Minchan Kim <minchan.kim@gmail.com>
Cc: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
Cc: Yasuaki Ishimatsu <isimatu.yasuaki@jp.fujitsu.com>
Cc: Dave Hansen <dave@linux.vnet.ibm.com>
Cc: Mel Gorman <mel@csn.ul.ie>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm/sparse.c')
-rw-r--r-- | mm/sparse.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/mm/sparse.c b/mm/sparse.c index a83de2f72b30..c7be01906998 100644 --- a/mm/sparse.c +++ b/mm/sparse.c | |||
@@ -771,6 +771,27 @@ out: | |||
771 | return ret; | 771 | return ret; |
772 | } | 772 | } |
773 | 773 | ||
774 | #ifdef CONFIG_MEMORY_FAILURE | ||
775 | static void clear_hwpoisoned_pages(struct page *memmap, int nr_pages) | ||
776 | { | ||
777 | int i; | ||
778 | |||
779 | if (!memmap) | ||
780 | return; | ||
781 | |||
782 | for (i = 0; i < PAGES_PER_SECTION; i++) { | ||
783 | if (PageHWPoison(&memmap[i])) { | ||
784 | atomic_long_sub(1, &mce_bad_pages); | ||
785 | ClearPageHWPoison(&memmap[i]); | ||
786 | } | ||
787 | } | ||
788 | } | ||
789 | #else | ||
790 | static inline void clear_hwpoisoned_pages(struct page *memmap, int nr_pages) | ||
791 | { | ||
792 | } | ||
793 | #endif | ||
794 | |||
774 | void sparse_remove_one_section(struct zone *zone, struct mem_section *ms) | 795 | void sparse_remove_one_section(struct zone *zone, struct mem_section *ms) |
775 | { | 796 | { |
776 | struct page *memmap = NULL; | 797 | struct page *memmap = NULL; |
@@ -784,6 +805,7 @@ void sparse_remove_one_section(struct zone *zone, struct mem_section *ms) | |||
784 | ms->pageblock_flags = NULL; | 805 | ms->pageblock_flags = NULL; |
785 | } | 806 | } |
786 | 807 | ||
808 | clear_hwpoisoned_pages(memmap, PAGES_PER_SECTION); | ||
787 | free_section_usemap(memmap, usemap); | 809 | free_section_usemap(memmap, usemap); |
788 | } | 810 | } |
789 | #endif | 811 | #endif |