linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Bin Wang <wangbin224@huawei.com>
To: <linux-mm@kvack.org>
Cc: <naoya.horiguchi@nec.com>, <akpm@linux-foundation.org>,
	<wuxu.wu@huawei.com>, <linux-kernel@vger.kernel.org>
Subject: [PATCH] mm/hwpoison: dissolve error hugepages of file mapping
Date: Thu, 15 Jul 2021 23:08:52 +0800	[thread overview]
Message-ID: <20210715150852.1655-1-wangbin224@huawei.com> (raw)

We handle error on hugetlb file with hugetlbfs_error_remove_page(),
which removes the error hugepages from page cache. And with the
HWPoison flag in head page, it is safe to free the error hugepages
and dissolve it.

Fixes: 78bb920344b8a ("mm: hwpoison: dissolve in-use hugepage in unrecoverable memory error")
Signed-off-by: Bin Wang <wangbin224@huawei.com>
---
 mm/memory-failure.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/mm/memory-failure.c b/mm/memory-failure.c
index eefd823deb67..6a3c46b601ef 100644
--- a/mm/memory-failure.c
+++ b/mm/memory-failure.c
@@ -988,6 +988,13 @@ static int me_huge_page(struct page *p, unsigned long pfn)
 	if (mapping) {
 		res = truncate_error_page(hpage, pfn, mapping);
 		unlock_page(hpage);
+		if (ret == MF_RECOVERED) {
+			put_page(hpage);
+			if (__page_handle_poison(p))
+				page_ref_inc(p);
+			else
+				ret = MF_FAILED;
+		}
 	} else {
 		res = MF_FAILED;
 		unlock_page(hpage);
-- 
2.23.0


             reply	other threads:[~2021-07-15 15:09 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-15 15:08 Bin Wang [this message]
2021-07-15 15:22 ` [PATCH] mm/hwpoison: dissolve error hugepages of file mapping Matthew Wilcox
2021-07-16  1:00   ` Bin Wang

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=20210715150852.1655-1-wangbin224@huawei.com \
    --to=wangbin224@huawei.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=naoya.horiguchi@nec.com \
    --cc=wuxu.wu@huawei.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;
as well as URLs for NNTP newsgroup(s).