Skip to content

Commit 70168fd

Browse files
Matthew Wilcox (Oracle)gregkh
authored andcommitted
mm/memory-failure: check the mapcount of the precise page
[ Upstream commit c79c5a0 ] 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]> Signed-off-by: Sasha Levin <[email protected]>
1 parent 18203c4 commit 70168fd

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
@@ -1010,7 +1010,7 @@ static bool hwpoison_user_mappings(struct page *p, unsigned long pfn,
10101010
* This check implies we don't kill processes if their pages
10111011
* are in the swap cache early. Those are always late kills.
10121012
*/
1013-
if (!page_mapped(hpage))
1013+
if (!page_mapped(p))
10141014
return true;
10151015

10161016
if (PageKsm(p)) {
@@ -1075,12 +1075,12 @@ static bool hwpoison_user_mappings(struct page *p, unsigned long pfn,
10751075
unmap_success = false;
10761076
}
10771077
} else {
1078-
unmap_success = try_to_unmap(hpage, ttu);
1078+
unmap_success = try_to_unmap(p, ttu);
10791079
}
10801080
}
10811081
if (!unmap_success)
10821082
pr_err("Memory failure: %#lx: failed to unmap page (mapcount=%d)\n",
1083-
pfn, page_mapcount(hpage));
1083+
pfn, page_mapcount(p));
10841084

10851085
/*
10861086
* try_to_unmap() might put mlocked page in lru cache, so call

0 commit comments

Comments
 (0)