Skip to content

Commit 783657a

Browse files
Naoya Horiguchitorvalds
authored andcommitted
mm: soft offline: split thp at the beginning of soft_offline_page()
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> Cc: <stable@vger.kernel.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent 782fd30 commit 783657a

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

mm/memory-failure.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1476,9 +1476,17 @@ int soft_offline_page(struct page *page, int flags)
14761476
{
14771477
int ret;
14781478
unsigned long pfn = page_to_pfn(page);
1479+
struct page *hpage = compound_trans_head(page);
14791480

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

14831491
ret = get_any_page(page, pfn, flags);
14841492
if (ret < 0)

0 commit comments

Comments
 (0)