From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932204AbdDRHTa (ORCPT ); Tue, 18 Apr 2017 03:19:30 -0400 Received: from mx2.suse.de ([195.135.220.15]:42086 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751898AbdDRHT1 (ORCPT ); Tue, 18 Apr 2017 03:19:27 -0400 Date: Tue, 18 Apr 2017 09:19:23 +0200 From: Michal Hocko To: Jerome Glisse Cc: linux-mm@kvack.org, Andrew Morton , Mel Gorman , Vlastimil Babka , Andrea Arcangeli , Reza Arbab , Yasuaki Ishimatsu , qiuxishi@huawei.com, Kani Toshimitsu , slaoub@gmail.com, Joonsoo Kim , Andi Kleen , David Rientjes , Daniel Kiper , Igor Mammedov , Vitaly Kuznetsov , LKML , Dan Williams Subject: Re: [PATCH 4/9] mm, memory_hotplug: get rid of is_zone_device_section Message-ID: <20170418071923.GE22360@dhcp22.suse.cz> References: <20170410110351.12215-1-mhocko@kernel.org> <20170410110351.12215-5-mhocko@kernel.org> <20170417201235.GA6511@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20170417201235.GA6511@redhat.com> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- >>From 38efdaf68b5c79df953385e9385581f75d46e651 Mon Sep 17 00:00:00 2001 From: Michal Hocko Date: Tue, 18 Apr 2017 09:17:31 +0200 Subject: [PATCH] fold me "mm, memory_hotplug: get rid of is_zone_device_section" - fix remove_memory_section unlock on find_memory_block failure as per Jerome - spotted by Evgeny Baskakov --- drivers/base/memory.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/base/memory.c b/drivers/base/memory.c index 45c25e2e3da4..5ae81617f11d 100644 --- a/drivers/base/memory.c +++ b/drivers/base/memory.c @@ -746,7 +746,7 @@ static int remove_memory_section(unsigned long node_id, */ mem = find_memory_block(section); if (!mem) - return 0; + goto out_unlock; unregister_mem_sect_under_nodes(mem, __section_nr(section)); @@ -756,6 +756,7 @@ static int remove_memory_section(unsigned long node_id, else put_device(&mem->dev); +out_unlock: mutex_unlock(&mem_sysfs_mutex); return 0; } -- 2.11.0 > Between when are you planning on reposting ? this weak, the sooner the better. Thanks! -- Michal Hocko SUSE Labs