Re: [PATCH v4 02/12] mm/rmap: Add try_to_unmap_hugetlb_one

From: Lance Yang

Date: Thu Jun 18 2026 - 05:09:56 EST




On 2026/6/18 15:55, David Hildenbrand (Arm) wrote:
return __rste_to_pte(pte_val(*ptep));
}

+ VM_WARN_ON(!pte_present(pteval));
+ subpage = folio_page(folio, pte_pfn(pteval) - folio_pfn(folio));

No need for subpages.

So plain ptep_get() can feed raw huge-entry bits into pte_pfn(), and the
derived subpage can be wrong.

Good question which impact that might have in practice?

The subpage check can warn, but we still pass that subpage to
make_hwpoison_entry(). So the hwpoison marker can end up with the
wrong PFN?

+ subpage = folio_page(folio, pte_pfn(pteval) - folio_pfn(folio));
+ VM_WARN_ON(folio_page(folio, 0) != subpage);
[...]
+ pteval = swp_entry_to_pte(make_hwpoison_entry(subpage));