diff options
author | Naoya Horiguchi <n-horiguchi@ah.jp.nec.com> | 2012-11-29 16:54:34 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-11-30 11:51:18 -0500 |
commit | 783657a7dc20e5c0efbc9a09a9dd38e238a723da (patch) | |
tree | 0c0d469c5d5ac18ecc89e4d7de27be652a07166f /mm | |
parent | 782fd30406ecb9d9b082816abe0c6008fc72a7b0 (diff) |
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>
Diffstat (limited to 'mm')
-rw-r--r-- | mm/memory-failure.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/mm/memory-failure.c b/mm/memory-failure.c index 6c5899b9034a..8b20278be6a6 100644 --- a/mm/memory-failure.c +++ b/mm/memory-failure.c | |||
@@ -1476,9 +1476,17 @@ int soft_offline_page(struct page *page, int flags) | |||
1476 | { | 1476 | { |
1477 | int ret; | 1477 | int ret; |
1478 | unsigned long pfn = page_to_pfn(page); | 1478 | unsigned long pfn = page_to_pfn(page); |
1479 | struct page *hpage = compound_trans_head(page); | ||
1479 | 1480 | ||
1480 | if (PageHuge(page)) | 1481 | if (PageHuge(page)) |
1481 | return soft_offline_huge_page(page, flags); | 1482 | 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 | } | ||
1482 | 1490 | ||
1483 | ret = get_any_page(page, pfn, flags); | 1491 | ret = get_any_page(page, pfn, flags); |
1484 | if (ret < 0) | 1492 | if (ret < 0) |