Re: [PATCH v2 3/3] drivers/base/memory: fix locking for poison accounting lookup
From: Muchun Song
Date: Thu Apr 30 2026 - 22:56:22 EST
> On Apr 30, 2026, at 23:50, Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> wrote:
>
> On Thu, 30 Apr 2026 15:59:33 +0800 Muchun Song <muchun.song@xxxxxxxxx> wrote:
>
>>>> Lockdep would flag this as sleeping while atomic when acquiring mutex I think.
>>>
>>> Another thought would be, that we always call the inc/sub from memory failure
>>> code while we hold a folio reference and the page is not poisoned yet.
>>>
>>> That way, memory offlining cannot continue and the memory block cannot go away.
>>>
>>> So we'd let out page reference keep the memory block alive.
>>
>> It seems unnecessary to hold lock_device_hotplug if the user already holds a
>> refcount on the page. I'd like to drop this patch.
>
> Dropped, thanks.
Thank you so much for helping me with this.
Thanks,
Muchun.
>
> mm-hotfixes-unstable still has
>
> "mm/memory_hotplug: fix memory block reference leak on remove"
> and
> "drivers/base/memory: fix memory block reference leak in poison accounting"