Patchwork [3.5.y.z,extended,stable] Patch "mm: soft offline: split thp at the beginning of" has been added to staging queue

mail settings
Submitter Herton Ronaldo Krzesinski
Date Dec. 10, 2012, 5:01 p.m.
Message ID <>
Download mbox | patch
Permalink /patch/204984/
State New
Headers show


Herton Ronaldo Krzesinski - Dec. 10, 2012, 5:01 p.m.
This is a note to let you know that I have just added a patch titled

    mm: soft offline: split thp at the beginning of

to the linux-3.5.y-queue branch of the 3.5.y.z extended stable tree 
which can be found at:;a=shortlog;h=refs/heads/linux-3.5.y-queue

If you, or anyone else, feels it should not be added to this tree, please 
reply to this email.

For more information about the 3.5.y.z tree, see



From d2c263d5ad721609a82bcc037e3252ae737b5690 Mon Sep 17 00:00:00 2001
From: Naoya Horiguchi <>
Date: Thu, 29 Nov 2012 13:54:34 -0800
Subject: [PATCH] mm: soft offline: split thp at the beginning of

commit 783657a7dc20e5c0efbc9a09a9dd38e238a723da 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 <>
Cc: Andi Kleen <>
Cc: Tony Luck <>
Cc: Andi Kleen <>
Cc: Wu Fengguang <>
Signed-off-by: Andrew Morton <>
Signed-off-by: Linus Torvalds <>
Signed-off-by: Herton Ronaldo Krzesinski <>
 mm/memory-failure.c |    8 ++++++++
 1 file changed, 8 insertions(+)



diff --git a/mm/memory-failure.c b/mm/memory-failure.c
index 6de0d61..1bf1092 100644
--- a/mm/memory-failure.c
+++ b/mm/memory-failure.c
@@ -1481,9 +1481,17 @@  int soft_offline_page(struct page *page, int flags)
 	int ret;
 	unsigned long pfn = page_to_pfn(page);
+	struct page *hpage = compound_trans_head(page);

 	if (PageHuge(page))
 		return soft_offline_huge_page(page, flags);
+	if (PageTransHuge(hpage)) {
+		if (PageAnon(hpage) && unlikely(split_huge_page(hpage))) {
+			pr_info("soft offline: %#lx: failed to split THP\n",
+				pfn);
+			return -EBUSY;
+		}
+	}

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