Re: [PATCH v2] mm/memory-failure: teach kill_accessing_process to accept hugetlb tail page pfn
From: Matthew Wilcox
Date: Fri Dec 19 2025 - 13:18:45 EST
On Fri, Dec 19, 2025 at 10:55:16AM -0700, Jane Chu wrote:
> static int check_hwpoisoned_entry(pte_t pte, unsigned long addr, short shift,
> - unsigned long poisoned_pfn, struct to_kill *tk)
> + unsigned long poisoned_pfn, struct to_kill *tk,
> + int pte_nr)
if we pass in huge_page_mask() instead ...
> {
> unsigned long pfn = 0;
> + unsigned long hwpoison_vaddr;
>
> if (pte_present(pte)) {
> pfn = pte_pfn(pte);
> @@ -694,10 +696,11 @@ static int check_hwpoisoned_entry(pte_t pte, unsigned long addr, short shift,
> pfn = swp_offset_pfn(swp);
> }
>
> - if (!pfn || pfn != poisoned_pfn)
> + if (!pfn || (pfn > poisoned_pfn || (pfn + pte_nr - 1) < poisoned_pfn))
... then we can simplify this to:
if (!pfn || ((pfn | mask) != (poisoned_pfn | mask))
> return 0;
> @@ -2037,6 +2038,7 @@ static int try_memory_failure_hugetlb(unsigned long pfn, int flags, int *hugetlb
> return action_result(pfn, MF_MSG_GET_HWPOISON, MF_IGNORED);
> }
>
> +
> folio = page_folio(p);
> folio_lock(folio);
unnecessary whitespace change