Re: [PATCH] mm/memory_hotplug: don't offline a hwpoisoned page still in the page cache
From: David Hildenbrand (Arm)
Date: Sat Nov 07 2026 - 14:41:37 EST
On 11/3/26 20:59, Mani Tofigh wrote:
> On 11/2/26 1:56 AM, David Hildenbrand (Arm) wrote:
>>
>> What if we still have the page pinned somehow? (vmscplice etc).
>>
>> Wouldn't it be better to make sure that poisoning code holds exactly one
>> reference (whoever set hwpoison) and check here that the refcount is 1 ?
>>
>> Pagecache references would turn it > 1.
>
>
> Yes right, a pin isn't covered (neither before nor with this patch).
>
> I don't think refcount == 1 can replace the mapping check though. In the
> race from the changelog memory_failure() has set PG_hwpoison but is
> still waiting in get_hwpoison_page(), so it doesn't hold its reference
> yet, and a clean page-cache folio then has just the one reference from
> the page cache. memory_failure() also doesn't take a reference on the
> kernel pages it ignores, and a poisoned page that gets freed later sits
> at 0.
So the right fix is to fix that then.
We'd need to sync memory_failure() with memory offlining, correct?
--
Cheers,
David