]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
mm: fixup pfnmap memory failure handling to use pgoff
authorAnkit Agrawal <ankita@nvidia.com>
Thu, 11 Dec 2025 07:06:01 +0000 (07:06 +0000)
committerAndrew Morton <akpm@linux-foundation.org>
Tue, 23 Dec 2025 19:23:15 +0000 (11:23 -0800)
commite6dbcb7c0e7b508d443a9aa6f77f63a2f83b1ae4
treea3adceea72ed3cbe92aab6b2ff63db51cc85a402
parent7013803444dd3bbbe28fd3360c084cec3057c554
mm: fixup pfnmap memory failure handling to use pgoff

The memory failure handling implementation for the PFNMAP memory with no
struct pages is faulty.  The VA of the mapping is determined based on the
the PFN.  It should instead be based on the file mapping offset.

At the occurrence of poison, the memory_failure_pfn is triggered on the
poisoned PFN.  Introduce a callback function that allows mm to translate
the PFN to the corresponding file page offset.  The kernel module using
the registration API must implement the callback function and provide the
translation.  The translated value is then used to determine the VA
information and sending the SIGBUS to the usermode process mapped to the
poisoned PFN.

The callback is also useful for the driver to be notified of the poisoned
PFN, which may then track it.

Link: https://lkml.kernel.org/r/20251211070603.338701-2-ankita@nvidia.com
Fixes: 2ec41967189c ("mm: handle poisoning of pfn without struct pages")
Signed-off-by: Ankit Agrawal <ankita@nvidia.com>
Suggested-by: Jason Gunthorpe <jgg@nvidia.com>
Cc: Kevin Tian <kevin.tian@intel.com>
Cc: Matthew R. Ochs <mochs@nvidia.com>
Cc: Miaohe Lin <linmiaohe@huawei.com>
Cc: Naoya Horiguchi <nao.horiguchi@gmail.com>
Cc: Neo Jia <cjia@nvidia.com>
Cc: Vikram Sethi <vsethi@nvidia.com>
Cc: Yishai Hadas <yishaih@nvidia.com>
Cc: Zhi Wang <zhiw@nvidia.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
include/linux/memory-failure.h
mm/memory-failure.c