Re: [PATCH 1/2] mm/memory_hotplug: fix memory block reference leak on remove
From: Oscar Salvador
Date: Mon Apr 27 2026 - 04:14:57 EST
On Mon, Apr 27, 2026 at 04:02:17PM +0800, Muchun Song wrote:
>
>
> > On Apr 27, 2026, at 15:49, Oscar Salvador <osalvador@xxxxxxx> wrote:
> > 2) I kind of dislike having an internal put_device() lingering here in
> > memory-hotplug code, it feels like it does not really belong here.
> > Ideally we should have a high-level function in drivers/base/memory.c
> > that calls put_device itself.
> > Something like "put_memblock_dev", dunno, names are hard.
> >
>
> I share your perspective. The current naming of find_memory_block_by_id
> is ambiguous as it fails to signal the internal 'get' operation. To improve
> clarity and reduce errors, it should be renamed to memory_block_get_by_id.
> Pairing this with a new memory_block_put function to wrap put_device
> would ensure a more robust and intuitive API.
Even better, yes.
Thanks!
--
Oscar Salvador
SUSE Labs