The patch titled Subject: mm/memory-failure: check the mapcount of the precise page has been added to the -mm mm-hotfixes-unstable branch. Its filename is mm-memory-failure-check-the-mapcount-of-the-precise-page.patch This patch will shortly appear at https://git.kernel.org/pub/scm/linux/kernel/git/akpm/25-new.git/tree/patches/mm-memory-failure-check-the-mapcount-of-the-precise-page.patch This patch will later appear in the mm-hotfixes-unstable branch at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/process/submit-checklist.rst when testing your code *** The -mm tree is included into linux-next via the mm-everything branch at git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm and is updated there every 2-3 working days ------------------------------------------------------ From: "Matthew Wilcox (Oracle)" <willy@xxxxxxxxxxxxx> Subject: mm/memory-failure: check the mapcount of the precise page Date: Mon, 18 Dec 2023 13:58:36 +0000 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/20231218135837.3310403-3-willy@xxxxxxxxxxxxx Fixes: 7af446a841a2 ("HWPOISON, hugetlb: enable error handling path for hugepage") Signed-off-by: Matthew Wilcox (Oracle) <willy@xxxxxxxxxxxxx> Cc: Dan Williams <dan.j.williams@xxxxxxxxx> Cc: Naoya Horiguchi <n-horiguchi@xxxxxxxxxxxxx> Cc: <stable@xxxxxxxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- mm/memory-failure.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) --- a/mm/memory-failure.c~mm-memory-failure-check-the-mapcount-of-the-precise-page +++ a/mm/memory-failure.c @@ -1570,7 +1570,7 @@ static bool hwpoison_user_mappings(struc * This check implies we don't kill processes if their pages * are in the swap cache early. Those are always late kills. */ - if (!page_mapped(hpage)) + if (!page_mapped(p)) return true; if (PageSwapCache(p)) { @@ -1621,10 +1621,10 @@ static bool hwpoison_user_mappings(struc try_to_unmap(folio, ttu); } - unmap_success = !page_mapped(hpage); + unmap_success = !page_mapped(p); if (!unmap_success) pr_err("%#lx: failed to unmap page (mapcount=%d)\n", - pfn, page_mapcount(hpage)); + pfn, page_mapcount(p)); /* * try_to_unmap() might put mlocked page in lru cache, so call _ Patches currently in -mm which might be from willy@xxxxxxxxxxxxx are mm-memory-failure-pass-the-folio-and-the-page-to-collect_procs.patch mm-memory-failure-check-the-mapcount-of-the-precise-page.patch mm-memory-failure-cast-index-to-loff_t-before-shifting-it.patch mailmap-add-an-old-address-for-naoya-horiguchi.patch buffer-return-bool-from-grow_dev_folio.patch buffer-calculate-block-number-inside-folio_init_buffers.patch buffer-fix-grow_buffers-for-block-size-page_size.patch buffer-cast-block-to-loff_t-before-shifting-it.patch buffer-fix-various-functions-for-block-size-page_size.patch buffer-handle-large-folios-in-__block_write_begin_int.patch buffer-fix-more-functions-for-block-size-page_size.patch mm-convert-ksm_might_need_to_copy-to-work-on-folios.patch mm-convert-ksm_might_need_to_copy-to-work-on-folios-fix.patch mm-remove-pageanonexclusive-assertions-in-unuse_pte.patch mm-convert-unuse_pte-to-use-a-folio-throughout.patch mm-remove-some-calls-to-page_add_new_anon_rmap.patch mm-remove-stale-example-from-comment.patch mm-remove-references-to-page_add_new_anon_rmap-in-comments.patch mm-convert-migrate_vma_insert_page-to-use-a-folio.patch mm-convert-collapse_huge_page-to-use-a-folio.patch mm-remove-page_add_new_anon_rmap-and-lru_cache_add_inactive_or_unevictable.patch mm-return-the-folio-from-__read_swap_cache_async.patch mm-pass-a-folio-to-__swap_writepage.patch mm-pass-a-folio-to-swap_writepage_fs.patch mm-pass-a-folio-to-swap_writepage_bdev_sync.patch mm-pass-a-folio-to-swap_writepage_bdev_async.patch mm-pass-a-folio-to-swap_readpage_fs.patch mm-pass-a-folio-to-swap_readpage_bdev_sync.patch mm-pass-a-folio-to-swap_readpage_bdev_async.patch mm-convert-swap_page_sector-to-swap_folio_sector.patch mm-convert-swap_readpage-to-swap_read_folio.patch mm-remove-page_swap_info.patch mm-return-a-folio-from-read_swap_cache_async.patch mm-convert-swap_cluster_readahead-and-swap_vma_readahead-to-return-a-folio.patch