Re: [PATCH v3] mm/memory-failure: set PG_hwpoison of a non-hugetlb page under hugetlb_lock

From: Mani Tofigh

Date: Mon Nov 23 2026 - 13:53:08 EST


On 11/23/26 2:26 AM, Miaohe Lin wrote:
If P's struct page is past the first vmemmap page, the hwpoison flag is lost. In this case,
do we need to do something? Now that hwpoison flag is already lost, I don't think so. And
TestClearPageHWPoison won't do anything in this case. Or do you mean TestClearPageHWPoison
will always write even if hwpoison flag is not set? If so, can test + clear do the work?


Yup, that's what I meant. And good call, test + clear works too.

I think we can correctly clear the stale flag from the first round.


Yes actually, so just this under Muchun's rwsem:
if (PageHWPoison(p))
ClearPageHWPoison(p);

should be enough? I can do this for v5; sounds good?

Thanks,
Mani