aboutsummaryrefslogtreecommitdiffstats
path: root/mm
diff options
context:
space:
mode:
authorNaoya Horiguchi <n-horiguchi@ah.jp.nec.com>2016-01-15 19:57:46 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2016-01-15 20:56:32 -0500
commit98fd1ef4241ce0c700a174dd3e33c643b4774690 (patch)
tree1ace006ae24580bcdb8424f46a11e28c7397aa77 /mm
parentacc14dc4bd484f1fc8c227dd9fc2a1e592312d2b (diff)
mm: soft-offline: exit with failure for non anonymous thp
Currently memory_failure() doesn't handle non anonymous thp case, because we can hardly expect the error handling to be successful, and it can just hit some corner case which results in BUG_ON or something severe like that. This is also the case for soft offline code, so let's make it in the same way. Orignal code has a MF_COUNT_INCREASED check before put_hwpoison_page(), but it's unnecessary because get_any_page() is already called when running on this code, which takes a refcount of the target page regardress of the flag. So this patch also removes it. [akpm@linux-foundation.org: fix build] Signed-off-by: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com> Cc: Andi Kleen <andi@firstfloor.org> Cc: "Kirill A. Shutemov" <kirill@shutemov.name> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm')
-rw-r--r--mm/memory-failure.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/mm/memory-failure.c b/mm/memory-failure.c
index 2015c9a06cae..ac595e7a3a95 100644
--- a/mm/memory-failure.c
+++ b/mm/memory-failure.c
@@ -1691,16 +1691,16 @@ static int soft_offline_in_use_page(struct page *page, int flags)
1691 1691
1692 if (!PageHuge(page) && PageTransHuge(hpage)) { 1692 if (!PageHuge(page) && PageTransHuge(hpage)) {
1693 lock_page(hpage); 1693 lock_page(hpage);
1694 ret = split_huge_page(hpage); 1694 if (!PageAnon(hpage) || unlikely(split_huge_page(hpage))) {
1695 unlock_page(hpage); 1695 unlock_page(hpage);
1696 if (unlikely(ret || PageTransCompound(page) || 1696 if (!PageAnon(hpage))
1697 !PageAnon(page))) { 1697 pr_info("soft offline: %#lx: non anonymous thp\n", page_to_pfn(page));
1698 pr_info("soft offline: %#lx: failed to split THP\n", 1698 else
1699 page_to_pfn(page)); 1699 pr_info("soft offline: %#lx: thp split failed\n", page_to_pfn(page));
1700 if (flags & MF_COUNT_INCREASED) 1700 put_hwpoison_page(hpage);
1701 put_hwpoison_page(hpage);
1702 return -EBUSY; 1701 return -EBUSY;
1703 } 1702 }
1703 unlock_page(hpage);
1704 get_hwpoison_page(page); 1704 get_hwpoison_page(page);
1705 put_hwpoison_page(hpage); 1705 put_hwpoison_page(hpage);
1706 } 1706 }