Skip to content

Commit

Permalink
mm: soft-offline: exit with failure for non anonymous thp
Browse files Browse the repository at this point in the history
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.

[[email protected]: fix build]
Signed-off-by: Naoya Horiguchi <[email protected]>
Cc: Andi Kleen <[email protected]>
Cc: "Kirill A. Shutemov" <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
Naoya Horiguchi authored and torvalds committed Jan 16, 2016
1 parent acc14dc commit 98fd1ef
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions mm/memory-failure.c
Original file line number Diff line number Diff line change
Expand Up @@ -1691,16 +1691,16 @@ static int soft_offline_in_use_page(struct page *page, int flags)

if (!PageHuge(page) && PageTransHuge(hpage)) {
lock_page(hpage);
ret = split_huge_page(hpage);
unlock_page(hpage);
if (unlikely(ret || PageTransCompound(page) ||
!PageAnon(page))) {
pr_info("soft offline: %#lx: failed to split THP\n",
page_to_pfn(page));
if (flags & MF_COUNT_INCREASED)
put_hwpoison_page(hpage);
if (!PageAnon(hpage) || unlikely(split_huge_page(hpage))) {
unlock_page(hpage);
if (!PageAnon(hpage))
pr_info("soft offline: %#lx: non anonymous thp\n", page_to_pfn(page));
else
pr_info("soft offline: %#lx: thp split failed\n", page_to_pfn(page));
put_hwpoison_page(hpage);
return -EBUSY;
}
unlock_page(hpage);
get_hwpoison_page(page);
put_hwpoison_page(hpage);
}
Expand Down

0 comments on commit 98fd1ef

Please sign in to comment.