diff mbox series

[v3,5/5] mm: hwpoison: handle non-anonymous THP correctly

Message ID 20210930215311.240774-6-shy828301@gmail.com (mailing list archive)
State New
Headers show
Series Solve silent data loss caused by poisoned page cache (shmem/tmpfs) | expand

Commit Message

Yang Shi Sept. 30, 2021, 9:53 p.m. UTC
Currently hwpoison doesn't handle non-anonymous THP, but since v4.8 THP
support for tmpfs and read-only file cache has been added.  They could
be offlined by split THP, just like anonymous THP.

Signed-off-by: Yang Shi <shy828301@gmail.com>
---
 mm/memory-failure.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

Comments

Naoya Horiguchi Oct. 1, 2021, 7:06 a.m. UTC | #1
On Thu, Sep 30, 2021 at 02:53:11PM -0700, Yang Shi wrote:
> Currently hwpoison doesn't handle non-anonymous THP, but since v4.8 THP
> support for tmpfs and read-only file cache has been added.  They could
> be offlined by split THP, just like anonymous THP.
> 
> Signed-off-by: Yang Shi <shy828301@gmail.com>

Acked-by: Naoya Horiguchi <naoya.horiguchi@nec.com>
Yang Shi Oct. 1, 2021, 9:09 p.m. UTC | #2
On Fri, Oct 1, 2021 at 12:06 AM Naoya Horiguchi
<naoya.horiguchi@linux.dev> wrote:
>
> On Thu, Sep 30, 2021 at 02:53:11PM -0700, Yang Shi wrote:
> > Currently hwpoison doesn't handle non-anonymous THP, but since v4.8 THP
> > support for tmpfs and read-only file cache has been added.  They could
> > be offlined by split THP, just like anonymous THP.
> >
> > Signed-off-by: Yang Shi <shy828301@gmail.com>
>
> Acked-by: Naoya Horiguchi <naoya.horiguchi@nec.com>

Thank you!
diff mbox series

Patch

diff --git a/mm/memory-failure.c b/mm/memory-failure.c
index 176883cd080f..88866bf4f4a9 100644
--- a/mm/memory-failure.c
+++ b/mm/memory-failure.c
@@ -1447,14 +1447,11 @@  static int identify_page_state(unsigned long pfn, struct page *p,
 static int try_to_split_thp_page(struct page *page, const char *msg)
 {
 	lock_page(page);
-	if (!PageAnon(page) || unlikely(split_huge_page(page))) {
+	if (unlikely(split_huge_page(page))) {
 		unsigned long pfn = page_to_pfn(page);
 
 		unlock_page(page);
-		if (!PageAnon(page))
-			pr_info("%s: %#lx: non anonymous thp\n", msg, pfn);
-		else
-			pr_info("%s: %#lx: thp split failed\n", msg, pfn);
+		pr_info("%s: %#lx: thp split failed\n", msg, pfn);
 		put_page(page);
 		return -EBUSY;
 	}