Re: [PATCH v2 3/3] drivers/base/memory: fix locking for poison accounting lookup

Andrew Morton
2026-04-30T16:28:30Z

On Thu, 30 Apr 2026 15:59:33 +0800 Muchun Song <muchun.song@linux.dev> 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.

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"