From: Miaohe Lin <linmiaohe@huawei.com>
To: <akpm@linux-foundation.org>, <naoya.horiguchi@nec.com>
Cc: <shy828301@gmail.com>, <linux-mm@kvack.org>,
<linux-kernel@vger.kernel.org>, <linmiaohe@huawei.com>
Subject: [PATCH 3/4] mm: memory-failure: avoid false hwpoison page mapped error info
Date: Sat, 15 Jul 2023 11:17:28 +0800 [thread overview]
Message-ID: <20230715031729.2420338-4-linmiaohe@huawei.com> (raw)
In-Reply-To: <20230715031729.2420338-1-linmiaohe@huawei.com>
folio->_mapcount is overloaded in SLAB, so folio_mapped() has to be done
after folio_test_slab() is checked. Otherwise slab folio might be treated
as a mapped folio leading to false 'Someone maps the hwpoison page' error
info.
Fixes: 230ac719c500 ("mm/hwpoison: don't try to unpoison containment-failed pages")
Signed-off-by: Miaohe Lin <linmiaohe@huawei.com>
---
mm/memory-failure.c | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/mm/memory-failure.c b/mm/memory-failure.c
index ac074f82f5b3..42e63b0ab5f7 100644
--- a/mm/memory-failure.c
+++ b/mm/memory-failure.c
@@ -2513,6 +2513,13 @@ int unpoison_memory(unsigned long pfn)
goto unlock_mutex;
}
+ if (folio_test_slab(folio) || PageTable(&folio->page) || folio_test_reserved(folio))
+ goto unlock_mutex;
+
+ /*
+ * Note that folio->_mapcount is overloaded in SLAB, so the simple test
+ * in folio_mapped() has to be done after folio_test_slab() is checked.
+ */
if (folio_mapped(folio)) {
unpoison_pr_info("Unpoison: Someone maps the hwpoison page %#lx\n",
pfn, &unpoison_rs);
@@ -2525,9 +2532,6 @@ int unpoison_memory(unsigned long pfn)
goto unlock_mutex;
}
- if (folio_test_slab(folio) || PageTable(&folio->page) || folio_test_reserved(folio))
- goto unlock_mutex;
-
ret = get_hwpoison_page(p, MF_UNPOISON);
if (!ret) {
if (PageHuge(p)) {
--
2.33.0
next prev parent reply other threads:[~2023-07-15 3:17 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-15 3:17 [PATCH 0/4] A few fixup and cleanup patches for memory-failure Miaohe Lin
2023-07-15 3:17 ` [PATCH 1/4] mm/swapfile: fix wrong swap entry type for hwpoisoned swapcache page Miaohe Lin
2023-07-15 3:50 ` Matthew Wilcox
2023-07-17 2:33 ` Miaohe Lin
2023-07-17 2:53 ` Matthew Wilcox
2023-07-17 5:55 ` Miaohe Lin
2023-07-23 2:23 ` Miaohe Lin
2023-07-15 3:17 ` [PATCH 2/4] mm: memory-failure: fix potential unexpected return value from unpoison_memory() Miaohe Lin
2023-07-19 23:48 ` Naoya Horiguchi
2023-07-20 8:44 ` Miaohe Lin
2023-07-15 3:17 ` Miaohe Lin [this message]
2023-07-15 3:59 ` [PATCH 3/4] mm: memory-failure: avoid false hwpoison page mapped error info Matthew Wilcox
2023-07-19 23:50 ` Naoya Horiguchi
2023-07-15 3:17 ` [PATCH 4/4] mm: memory-failure: add PageOffline() check Miaohe Lin
2023-07-20 1:09 ` Naoya Horiguchi
2023-07-20 8:42 ` Miaohe Lin
2023-07-20 23:55 ` Naoya Horiguchi
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=20230715031729.2420338-4-linmiaohe@huawei.com \
--to=linmiaohe@huawei.com \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=naoya.horiguchi@nec.com \
--cc=shy828301@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