linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Jinjiang Tu <tujinjiang@huawei.com>
To: <akpm@linux-foundation.org>, <linmiaohe@huawei.com>,
	<david@redhat.com>, <osalvador@suse.de>, <mhocko@kernel.org>
Cc: <linux-mm@kvack.org>, <wangkefeng.wang@huawei.com>,
	<tujinjiang@huawei.com>
Subject: [PATCH v2 1/2] mm/vmscan: fix hwpoisoned large folio handling in shrink_folio_list
Date: Fri, 27 Jun 2025 20:57:46 +0800	[thread overview]
Message-ID: <20250627125747.3094074-2-tujinjiang@huawei.com> (raw)
In-Reply-To: <20250627125747.3094074-1-tujinjiang@huawei.com>

In shrink_folio_list(), the hwpoisoned folio may be large folio, which
can't be handled by unmap_poisoned_folio().

Since UCE is rare in real world, and race with reclaimation is more rare,
just skipping the hwpoisoned large folio is enough. memory_failure() will
handle it if the UCE is triggered again.

Fixes: 1b0449544c64 ("mm/vmscan: don't try to reclaim hwpoison folio")
Reported-by: syzbot+3b220254df55d8ca8a61@syzkaller.appspotmail.com
Closes: https://lore.kernel.org/all/68412d57.050a0220.2461cf.000e.GAE@google.com/
Signed-off-by: Jinjiang Tu <tujinjiang@huawei.com>
---
 mm/vmscan.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/mm/vmscan.c b/mm/vmscan.c
index f8dfd2864bbf..424412680cfc 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -1138,6 +1138,14 @@ static unsigned int shrink_folio_list(struct list_head *folio_list,
 			goto keep;
 
 		if (folio_contain_hwpoisoned_page(folio)) {
+			/*
+			 * unmap_poisoned_folio() can't handle large
+			 * folio, just skip it. memory_failure() will
+			 * handle it if the UCE is triggered again.
+			 */
+			if (folio_test_large(folio))
+				goto keep_locked;
+
 			unmap_poisoned_folio(folio, folio_pfn(folio), false);
 			folio_unlock(folio);
 			folio_put(folio);
-- 
2.43.0



  reply	other threads:[~2025-06-27 13:02 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-27 12:57 [PATCH v2 0/2] fix two calls of unmap_poisoned_folio() for large folio Jinjiang Tu
2025-06-27 12:57 ` Jinjiang Tu [this message]
2025-06-27 17:10   ` [PATCH v2 1/2] mm/vmscan: fix hwpoisoned large folio handling in shrink_folio_list David Hildenbrand
2025-06-27 22:00   ` Andrew Morton
2025-06-28  2:38     ` Jinjiang Tu
2025-06-28  3:13   ` Miaohe Lin
2025-07-01 14:13   ` Oscar Salvador
2025-07-03  7:30     ` Jinjiang Tu
2025-06-27 12:57 ` [PATCH v2 2/2] mm/memory_hotplug: fix hwpoisoned large folio handling in do_migrate_range Jinjiang Tu
2025-07-01 14:21   ` Oscar Salvador
2025-07-03  7:46     ` Jinjiang Tu
2025-07-03  7:57       ` David Hildenbrand
2025-07-03  8:24         ` Jinjiang Tu
2025-07-03  9:06           ` David Hildenbrand
2025-07-07 11:51             ` Jinjiang Tu
2025-07-07 12:37               ` David Hildenbrand
2025-07-08  1:15                 ` Jinjiang Tu
2025-07-08  9:54                   ` David Hildenbrand
2025-07-09 16:27                     ` Zi Yan
2025-07-14 13:53                       ` Pankaj Raghav
2025-07-14 14:20                         ` Zi Yan
2025-07-14 14:24                           ` David Hildenbrand
2025-07-14 15:09                             ` Pankaj Raghav (Samsung)
2025-07-14 15:14                               ` David Hildenbrand
2025-07-14 15:25                                 ` Zi Yan
2025-07-14 15:28                                   ` Zi Yan
2025-07-14 15:33                                     ` David Hildenbrand
2025-07-14 15:44                                       ` Zi Yan
2025-07-14 15:52                                         ` David Hildenbrand
2025-07-20  2:23                                           ` Andrew Morton
2025-07-22 15:30                                             ` David Hildenbrand
2025-08-21  5:02                                               ` Andrew Morton
2025-08-21 22:07                                                 ` David Hildenbrand
2025-08-22 17:24                                                   ` Zi Yan
2025-08-25  2:05                                                   ` Miaohe Lin
2025-07-03  7:53   ` David Hildenbrand

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=20250627125747.3094074-2-tujinjiang@huawei.com \
    --to=tujinjiang@huawei.com \
    --cc=akpm@linux-foundation.org \
    --cc=david@redhat.com \
    --cc=linmiaohe@huawei.com \
    --cc=linux-mm@kvack.org \
    --cc=mhocko@kernel.org \
    --cc=osalvador@suse.de \
    --cc=wangkefeng.wang@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