mm/memory-failure: check the mapcount of the precise page
authorMatthew Wilcox (Oracle) <willy@infradead.org>
Mon, 18 Dec 2023 13:58:36 +0000 (13:58 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 5 Jan 2024 14:19:43 +0000 (15:19 +0100)
commitd16c5d215b53b395df51668fc8387dd618867814
tree8351c631f4079a3e94cdb2b75d4350a8e6e3bedf
parent8c7da70d9ae4c1abdf62d91d0aa28feee85c7f1b
mm/memory-failure: check the mapcount of the precise page

commit c79c5a0a00a9457718056b588f312baadf44e471 upstream.

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@infradead.org
Fixes: 7af446a841a2 ("HWPOISON, hugetlb: enable error handling path for hugepage")
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Cc: Dan Williams <dan.j.williams@intel.com>
Cc: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
mm/memory-failure.c