public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Jin Dongming <jin.dongming@np.css.fujitsu.com>
To: Andi Kleen <andi@firstfloor.org>, Andrea Arcangeli <aarcange@redhat.com>
Cc: AKPM  <akpm@linux-foundation.org>,
	"Hidetoshi Seto" <seto.hidetoshi@jp.fujitsu.com>,
	"Huang Ying" <ying.huang@intel.com>,
	LKLM <linux-kernel@vger.kernel.org>
Subject: [PATCH 1/3] Avoid unmapping THP when it is failed to be split.
Date: Tue, 25 Jan 2011 14:45:27 +0900	[thread overview]
Message-ID: <4D3E6377.6060803@np.css.fujitsu.com> (raw)

If the THP is failed to be split,
   1. The processes using the poisoned page could not be collected.
      (Because page_mapped_in_vma() in collect_procs_anon() always
       returns NULL.)
   2. The poisoned page could not be unmapped.
      (If CONFIG_DEBUG_VM is "y", VM_BUG_ON(PageTransHuge(page))
       in try_to_unmap() will be called, and system panic will be
       caused.)
   3. The processes using the poisoned page could not be killed, too.
      (Because no process is collected in 1.)

So if splitting THP is failed, it is better to stop unmapping
rather than causing panic. System might servive if the page is freed
later.

Signed-off-by: Jin Dongming <jin.dongming@np.css.fujitsu.com>
Reviewed-by: Hidetoshi Seto <seto.hidetoshi@jp.fujitsu.com>
---
 mm/memory-failure.c |   13 +++++++++++--
 1 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/mm/memory-failure.c b/mm/memory-failure.c
index 548fbd7..55f7d07 100644
--- a/mm/memory-failure.c
+++ b/mm/memory-failure.c
@@ -386,8 +386,6 @@ static void collect_procs_anon(struct page *page, struct list_head *to_kill,
 	struct task_struct *tsk;
 	struct anon_vma *av;
 
-	if (!PageHuge(page) && unlikely(split_huge_page(page)))
-		return;
 	read_lock(&tasklist_lock);
 	av = page_lock_anon_vma(page);
 	if (av == NULL)	/* Not actually mapped anymore */
@@ -896,6 +894,17 @@ static int hwpoison_user_mappings(struct page *p, unsigned long pfn,
 		}
 	}
 
+	if (!PageHuge(hpage) && PageAnon(hpage) &&
+	    unlikely(split_huge_page(hpage))) {
+		/*
+		 * FIXME: if splitting THP is failed, it is better to stop
+		 * the following operation rather than causing panic
+		 * by unmapping. System might survive if the page is freed later.
+		 */
+		printk(KERN_INFO "MCE %#lx: failed to split THP\n", pfn);
+		return SWAP_FAIL;
+	}
+
 	/*
 	 * First collect all the processes that have the page
 	 * mapped in dirty form.  This has to be done before try_to_unmap,
-- 
1.7.2.2



             reply	other threads:[~2011-01-25  5:42 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-01-25  5:45 Jin Dongming [this message]
2011-01-25 22:01 ` [PATCH 1/3] Avoid unmapping THP when it is failed to be split Andrea Arcangeli
2011-01-27  1:12   ` Jin Dongming

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=4D3E6377.6060803@np.css.fujitsu.com \
    --to=jin.dongming@np.css.fujitsu.com \
    --cc=aarcange@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=andi@firstfloor.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=seto.hidetoshi@jp.fujitsu.com \
    --cc=ying.huang@intel.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