On Wed 10-04-19 12:14:55, David Hildenbrand wrote:
> While current node handling is probably terribly broken for memory block
> devices that span several nodes (only possible when added during boot,
> and something like that should be blocked completely), properly put the
> device reference we obtained via find_memory_block() to get the nid.

The changelog could see some improvements I believe. (Half) stating
broken status of multinode memblock is not really useful without a wider
context so I would simply remove it. More to the point, it would be much
better to actually describe the actual problem and the user visible
effect.

"
d0dc12e86b31 ("mm/memory_hotplug: optimize memory hotplug") has started
using find_memory_block to get a nodeid for the beginnig of the onlined
pfn range. The commit has missed that the memblock contains a reference
counted object and a missing put_device will leak the kobject behind
which ADD THE USER VISIBLE EFFECT HERE.
"

> Fixes: d0dc12e86b31 ("mm/memory_hotplug: optimize memory hotplug")
> Cc: Andrew Morton <a...@linux-foundation.org>
> Cc: Oscar Salvador <osalva...@suse.de>
> Cc: Michal Hocko <mho...@suse.com>
> Cc: David Hildenbrand <da...@redhat.com>
> Cc: Pavel Tatashin <pasha.tatas...@soleen.com>
> Cc: Wei Yang <richard.weiy...@gmail.com>
> Cc: Qian Cai <c...@lca.pw>
> Cc: Arun KS <aru...@codeaurora.org>
> Cc: Mathieu Malaterre <ma...@debian.org>
> Signed-off-by: David Hildenbrand <da...@redhat.com>

Other than that
Acked-by: Michal Hocko <mho...@suse.com>

> ---
>  mm/memory_hotplug.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c
> index 5eb4a4c7c21b..328878b6799d 100644
> --- a/mm/memory_hotplug.c
> +++ b/mm/memory_hotplug.c
> @@ -854,6 +854,7 @@ int __ref online_pages(unsigned long pfn, unsigned long 
> nr_pages, int online_typ
>        */
>       mem = find_memory_block(__pfn_to_section(pfn));
>       nid = mem->nid;
> +     put_device(&mem->dev);
>  
>       /* associate pfn range with the zone */
>       zone = move_pfn_range(online_type, nid, pfn, nr_pages);
> -- 
> 2.20.1

-- 
Michal Hocko
SUSE Labs

Reply via email to