linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Andi Kleen <andi@firstfloor.org>,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org,
	Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>,
	Naoya Horiguchi <nao.horiguchi@gmail.com>,
	"Kirill A. Shutemov" <kirill@shutemov.name>
Subject: [PATCH v2 2/2] mm: soft-offline: exit with failure for non anonymous thp
Date: Tue, 12 Jan 2016 12:10:45 +0900	[thread overview]
Message-ID: <1452568245-10412-3-git-send-email-n-horiguchi@ah.jp.nec.com> (raw)
In-Reply-To: <1452568245-10412-1-git-send-email-n-horiguchi@ah.jp.nec.com>

Currently memory_failure() doesn't handle non anonymous thp case, because we
can hardly expect the error handling to be successful, and it can just hit
some corner case which results in BUG_ON or something severe like that.
This is also the case for soft offline code, so let's make it in the same way.

Orignal code has a MF_COUNT_INCREASED check before put_hwpoison_page(), but
it's unnecessary because get_any_page() is already called when running on
this code, which takes a refcount of the target page regardress of the flag.
So this patch also removes it.

Signed-off-by: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
---
ChangeLog v1->v2:
- rebased to next-20160111
---
 mm/memory-failure.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git next-20160111/mm/memory-failure.c next-20160111_patched/mm/memory-failure.c
index 2015c9a..6a2f290 100644
--- next-20160111/mm/memory-failure.c
+++ next-20160111_patched/mm/memory-failure.c
@@ -1691,16 +1691,16 @@ static int soft_offline_in_use_page(struct page *page, int flags)
 
 	if (!PageHuge(page) && PageTransHuge(hpage)) {
 		lock_page(hpage);
-		ret = split_huge_page(hpage);
-		unlock_page(hpage);
-		if (unlikely(ret || PageTransCompound(page) ||
-			     !PageAnon(page))) {
-			pr_info("soft offline: %#lx: failed to split THP\n",
-				page_to_pfn(page));
-			if (flags & MF_COUNT_INCREASED)
-				put_hwpoison_page(hpage);
+		if (!PageAnon(hpage) || unlikely(split_huge_page(hpage))) {
+			unlock_page(hpage);
+			if (!PageAnon(hpage))
+				pr_info("soft offline: %#lx: non anonymous thp\n", pfn);
+			else
+				pr_info("soft offline: %#lx: thp split failed\n", pfn);
+			put_hwpoison_page(hpage);
 			return -EBUSY;
 		}
+		unlock_page(hpage);
 		get_hwpoison_page(page);
 		put_hwpoison_page(hpage);
 	}
-- 
2.7.0

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

  parent reply	other threads:[~2016-01-12  3:10 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-08  7:24 [PATCH v1] " Naoya Horiguchi
2016-01-08 20:33 ` Andrew Morton
2016-01-12  3:10   ` Naoya Horiguchi
2016-01-12  3:10     ` [PATCH v2 1/2] mm: soft-offline: clean up soft_offline_page() Naoya Horiguchi
2016-01-12  3:10     ` Naoya Horiguchi [this message]
2016-01-12 23:49       ` [PATCH v2 2/2] mm: soft-offline: exit with failure for non anonymous thp Andrew Morton

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1452568245-10412-3-git-send-email-n-horiguchi@ah.jp.nec.com \
    --to=n-horiguchi@ah.jp.nec.com \
    --cc=akpm@linux-foundation.org \
    --cc=andi@firstfloor.org \
    --cc=kirill@shutemov.name \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=nao.horiguchi@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox