From mboxrd@z Thu Jan 1 00:00:00 1970 From: Wen Congyang Date: Mon, 30 Jul 2012 02:03:27 +0000 Subject: Re: [RFC PATCH v5 19/19] memory-hotplug: remove sysfs file of node Message-Id: <5015EB6F.40901@cn.fujitsu.com> List-Id: References: <50126B83.3050201@cn.fujitsu.com> <50126F21.803@cn.fujitsu.com> <5012712E.9000005@jp.fujitsu.com> In-Reply-To: <5012712E.9000005@jp.fujitsu.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: Yasuaki Ishimatsu Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-acpi@vger.kernel.org, linux-s390@vger.kernel.org, linux-sh@vger.kernel.org, linux-ia64@vger.kernel.org, cmetcalf@tilera.com, rientjes@google.com, liuj97@gmail.com, len.brown@intel.com, benh@kernel.crashing.org, paulus@samba.org, cl@linux.com, minchan.kim@gmail.com, akpm@linux-foundation.org, kosaki.motohiro@jp.fujitsu.com At 07/27/2012 06:45 PM, Yasuaki Ishimatsu Wrote: > Hi Wen, > > 2012/07/27 19:36, Wen Congyang wrote: >> From: Yasuaki Ishimatsu >> >> The patch adds node_set_offline() and unregister_one_node() to >> remove_memory() >> for removing sysfs file of node. >> >> CC: David Rientjes >> CC: Jiang Liu >> CC: Len Brown >> CC: Benjamin Herrenschmidt >> CC: Paul Mackerras >> CC: Christoph Lameter >> Cc: Minchan Kim >> CC: Andrew Morton >> CC: KOSAKI Motohiro >> CC: Wen Congyang >> Signed-off-by: Yasuaki Ishimatsu >> --- >> mm/memory_hotplug.c | 5 +++++ >> 1 files changed, 5 insertions(+), 0 deletions(-) >> >> diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c >> index 5ac035f..5681968 100644 >> --- a/mm/memory_hotplug.c >> +++ b/mm/memory_hotplug.c >> @@ -1267,6 +1267,11 @@ int __ref remove_memory(int nid, u64 start, u64 >> size) >> /* remove memmap entry */ >> firmware_map_remove(start, start + size, "System RAM"); >> >> + if (!node_present_pages(nid)) { > > Applying [PATCH v5 17/19], pgdat->node_spanned_pages can become 0 when > all memory of the pgdat is removed. When pgdat->node_spanned_pages is 0, > it means the pgdat has no memory. So I think node_spanned_pages() is > better. node_spanned_pages = present_pages + hole_pages So present_pages is always less or equal than spanned_pages, and I think checking present pages is better. Thanks Wen Congyang > > Thanks, > Yasuaki Ishimatsu > >> + node_set_offline(nid); >> + unregister_one_node(nid); >> + } >> + >> arch_remove_memory(start, size); >> out: >> unlock_memory_hotplug(); >> > > >