[PATCH 6.6.y] mm/memory-failure: fix missing ->mf_stats count when hugetlb folio already poisoned
From: Qi Xi
Date: Tue Jul 21 2026 - 08:34:59 EST
[ Upstream commit a148a2040191b12b45b82cb29c281cb3036baf90 ]
When a new subpage is poisoned on a hugetlb folio that has already been
marked hwpoison (MF_HUGETLB_FOLIO_PRE_POISONED), hugetlb_update_hwpoison()
increments num_poisoned_pages directly, but the per-node ->mf_stats is
not updated because this path bypasses action_result().
The upstream commit fixed this by routing all counting through
action_result(), but the backport to 6.6 as commit 252bb328b36f applied
only the refactoring without the core counting fix. This patch adds the
missing update_per_node_mf_stats() call to fix the inconsistency.
Fixes: 252bb328b36f ("mm/memory-failure: fix missing ->mf_stats count in hugetlb poison")
Signed-off-by: Qi Xi <xiqi2@xxxxxxxxxx>
---
mm/memory-failure.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/mm/memory-failure.c b/mm/memory-failure.c
index 86cdf36ee3bb..5f9203bf8ec1 100644
--- a/mm/memory-failure.c
+++ b/mm/memory-failure.c
@@ -1947,8 +1947,10 @@ static int hugetlb_update_hwpoison(struct folio *folio, struct page *page)
raw_hwp->page = page;
llist_add(&raw_hwp->node, head);
/* the first error event will be counted in action_result(). */
- if (ret)
+ if (ret) {
num_poisoned_pages_inc(page_to_pfn(page));
+ update_per_node_mf_stats(page_to_pfn(page), MF_FAILED);
+ }
} else {
/*
* Failed to save raw error info. We no longer trace all
--
2.33.0