diff options
author | Wu Fengguang <fengguang.wu@intel.com> | 2009-12-16 06:19:58 -0500 |
---|---|---|
committer | Andi Kleen <ak@linux.intel.com> | 2009-12-16 06:19:58 -0500 |
commit | 1668bfd5be9d8a52536c4865000fbbe065a3613b (patch) | |
tree | 85f060960de6e27f6933d56fcfd194b25ddbc460 /mm/memory-failure.c | |
parent | 82ba011b9041dd31c15e4f63797b08aa0a288e61 (diff) |
HWPOISON: abort on failed unmap
Don't try to isolate a still mapped page. Otherwise we will hit the
BUG_ON(page_mapped(page)) in __remove_from_page_cache().
Signed-off-by: Wu Fengguang <fengguang.wu@intel.com>
Signed-off-by: Andi Kleen <ak@linux.intel.com>
Diffstat (limited to 'mm/memory-failure.c')
-rw-r--r-- | mm/memory-failure.c | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/mm/memory-failure.c b/mm/memory-failure.c index 3338c443272c..b62287db87af 100644 --- a/mm/memory-failure.c +++ b/mm/memory-failure.c | |||
@@ -655,7 +655,7 @@ static int page_action(struct page_state *ps, struct page *p, | |||
655 | * Do all that is necessary to remove user space mappings. Unmap | 655 | * Do all that is necessary to remove user space mappings. Unmap |
656 | * the pages and send SIGBUS to the processes if the data was dirty. | 656 | * the pages and send SIGBUS to the processes if the data was dirty. |
657 | */ | 657 | */ |
658 | static void hwpoison_user_mappings(struct page *p, unsigned long pfn, | 658 | static int hwpoison_user_mappings(struct page *p, unsigned long pfn, |
659 | int trapno) | 659 | int trapno) |
660 | { | 660 | { |
661 | enum ttu_flags ttu = TTU_UNMAP | TTU_IGNORE_MLOCK | TTU_IGNORE_ACCESS; | 661 | enum ttu_flags ttu = TTU_UNMAP | TTU_IGNORE_MLOCK | TTU_IGNORE_ACCESS; |
@@ -665,15 +665,18 @@ static void hwpoison_user_mappings(struct page *p, unsigned long pfn, | |||
665 | int i; | 665 | int i; |
666 | int kill = 1; | 666 | int kill = 1; |
667 | 667 | ||
668 | if (PageReserved(p) || PageCompound(p) || PageSlab(p) || PageKsm(p)) | 668 | if (PageReserved(p) || PageSlab(p)) |
669 | return; | 669 | return SWAP_SUCCESS; |
670 | 670 | ||
671 | /* | 671 | /* |
672 | * This check implies we don't kill processes if their pages | 672 | * This check implies we don't kill processes if their pages |
673 | * are in the swap cache early. Those are always late kills. | 673 | * are in the swap cache early. Those are always late kills. |
674 | */ | 674 | */ |
675 | if (!page_mapped(p)) | 675 | if (!page_mapped(p)) |
676 | return; | 676 | return SWAP_SUCCESS; |
677 | |||
678 | if (PageCompound(p) || PageKsm(p)) | ||
679 | return SWAP_FAIL; | ||
677 | 680 | ||
678 | if (PageSwapCache(p)) { | 681 | if (PageSwapCache(p)) { |
679 | printk(KERN_ERR | 682 | printk(KERN_ERR |
@@ -735,6 +738,8 @@ static void hwpoison_user_mappings(struct page *p, unsigned long pfn, | |||
735 | */ | 738 | */ |
736 | kill_procs_ao(&tokill, !!PageDirty(p), trapno, | 739 | kill_procs_ao(&tokill, !!PageDirty(p), trapno, |
737 | ret != SWAP_SUCCESS, pfn); | 740 | ret != SWAP_SUCCESS, pfn); |
741 | |||
742 | return ret; | ||
738 | } | 743 | } |
739 | 744 | ||
740 | int __memory_failure(unsigned long pfn, int trapno, int flags) | 745 | int __memory_failure(unsigned long pfn, int trapno, int flags) |
@@ -807,8 +812,13 @@ int __memory_failure(unsigned long pfn, int trapno, int flags) | |||
807 | 812 | ||
808 | /* | 813 | /* |
809 | * Now take care of user space mappings. | 814 | * Now take care of user space mappings. |
815 | * Abort on fail: __remove_from_page_cache() assumes unmapped page. | ||
810 | */ | 816 | */ |
811 | hwpoison_user_mappings(p, pfn, trapno); | 817 | if (hwpoison_user_mappings(p, pfn, trapno) != SWAP_SUCCESS) { |
818 | printk(KERN_ERR "MCE %#lx: cannot unmap page, give up\n", pfn); | ||
819 | res = -EBUSY; | ||
820 | goto out; | ||
821 | } | ||
812 | 822 | ||
813 | /* | 823 | /* |
814 | * Torn down by someone else? | 824 | * Torn down by someone else? |