Skip to content

Commit 499c579

Browse files
Naoya Horiguchigregkh
Naoya Horiguchi
authored andcommitted
mm: soft offline: split thp at the beginning of soft_offline_page()
commit 783657a upstream. When we try to soft-offline a thp tail page, put_page() is called on the tail page unthinkingly and VM_BUG_ON is triggered in put_compound_page(). This patch splits thp before going into the main body of soft-offlining. Signed-off-by: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com> Cc: Andi Kleen <andi@firstfloor.org> Cc: Tony Luck <tony.luck@intel.com> Cc: Andi Kleen <andi.kleen@intel.com> Cc: Wu Fengguang <fengguang.wu@intel.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent f6c9a70 commit 499c579

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

mm/memory-failure.c

+8
Original file line numberDiff line numberDiff line change
@@ -1474,9 +1474,17 @@ int soft_offline_page(struct page *page, int flags)
14741474
{
14751475
int ret;
14761476
unsigned long pfn = page_to_pfn(page);
1477+
struct page *hpage = compound_trans_head(page);
14771478

14781479
if (PageHuge(page))
14791480
return soft_offline_huge_page(page, flags);
1481+
if (PageTransHuge(hpage)) {
1482+
if (PageAnon(hpage) && unlikely(split_huge_page(hpage))) {
1483+
pr_info("soft offline: %#lx: failed to split THP\n",
1484+
pfn);
1485+
return -EBUSY;
1486+
}
1487+
}
14801488

14811489
ret = get_any_page(page, pfn, flags);
14821490
if (ret < 0)

0 commit comments

Comments
 (0)