Skip to content

Commit 11bcecc

Browse files
Naoya Horiguchigregkh
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 8bec650 commit 11bcecc

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

mm/memory-failure.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1382,9 +1382,17 @@ int soft_offline_page(struct page *page, int flags)
13821382
{
13831383
int ret;
13841384
unsigned long pfn = page_to_pfn(page);
1385+
struct page *hpage = compound_trans_head(page);
13851386

13861387
if (PageHuge(page))
13871388
return soft_offline_huge_page(page, flags);
1389+
if (PageTransHuge(hpage)) {
1390+
if (PageAnon(hpage) && unlikely(split_huge_page(hpage))) {
1391+
pr_info("soft offline: %#lx: failed to split THP\n",
1392+
pfn);
1393+
return -EBUSY;
1394+
}
1395+
}
13881396

13891397
ret = get_any_page(page, pfn, flags);
13901398
if (ret < 0)

0 commit comments

Comments
 (0)