Skip to content

Commit c79c5a0

Browse files
Matthew Wilcox (Oracle)akpm00
authored andcommitted
mm/memory-failure: check the mapcount of the precise page
A process may map only some of the pages in a folio, and might be missed if it maps the poisoned page but not the head page. Or it might be unnecessarily hit if it maps the head page, but not the poisoned page. Link: https://lkml.kernel.org/r/[email protected] Fixes: 7af446a ("HWPOISON, hugetlb: enable error handling path for hugepage") Signed-off-by: Matthew Wilcox (Oracle) <[email protected]> Cc: Dan Williams <[email protected]> Cc: Naoya Horiguchi <[email protected]> Cc: <[email protected]> Signed-off-by: Andrew Morton <[email protected]>
1 parent 376907f commit c79c5a0

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

mm/memory-failure.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1570,7 +1570,7 @@ static bool hwpoison_user_mappings(struct page *p, unsigned long pfn,
15701570
* This check implies we don't kill processes if their pages
15711571
* are in the swap cache early. Those are always late kills.
15721572
*/
1573-
if (!page_mapped(hpage))
1573+
if (!page_mapped(p))
15741574
return true;
15751575

15761576
if (PageSwapCache(p)) {
@@ -1621,10 +1621,10 @@ static bool hwpoison_user_mappings(struct page *p, unsigned long pfn,
16211621
try_to_unmap(folio, ttu);
16221622
}
16231623

1624-
unmap_success = !page_mapped(hpage);
1624+
unmap_success = !page_mapped(p);
16251625
if (!unmap_success)
16261626
pr_err("%#lx: failed to unmap page (mapcount=%d)\n",
1627-
pfn, page_mapcount(hpage));
1627+
pfn, page_mapcount(p));
16281628

16291629
/*
16301630
* try_to_unmap() might put mlocked page in lru cache, so call

0 commit comments

Comments
 (0)