Re: [PATCH 4/9] mm, memory_hotplug: get rid of is_zone_device_section

From: Michal Hocko
Date: Tue Apr 18 2017 - 03:19:33 EST


On Mon 17-04-17 16:12:35, Jerome Glisse wrote:
[...]
> > @@ -741,11 +730,16 @@ static int remove_memory_section(unsigned long node_id,
> > {
> > struct memory_block *mem;
> >
> > - if (is_zone_device_section(section))
> > - return 0;
> > -
> > mutex_lock(&mem_sysfs_mutex);
> > +
> > + /*
> > + * Some users of the memory hotplug do not want/need memblock to
> > + * track all sections. Skip over those.
> > + */
> > mem = find_memory_block(section);
> > + if (!mem)
> > + return 0;
> > +
>
> Another bug above spoted by Evgeny Baskakov from NVidia, mutex unlock
> is missing ie something like:
>
> if (!mem) {
> mutex_unlock(&mem_sysfs_mutex);
> return 0;
> }

Thanks for spotting this. I went with the following fixup
---