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

From: Miaohe Lin

Date: Mon Nov 23 2026 - 22:11:57 EST


On 2026/11/24 2:52, Mani Tofigh wrote:
> 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?

Yes, sounds good to me. And some comments might be helpful. But do we really need that rwsem?
Could we avoid using that specified rwsem?

Thanks.
.