From mboxrd@z Thu Jan 1 00:00:00 1970 From: Yasuaki Ishimatsu Date: Fri, 27 Jul 2012 10:45:02 +0000 Subject: Re: [RFC PATCH v5 19/19] memory-hotplug: remove sysfs file of node Message-Id: <5012712E.9000005@jp.fujitsu.com> List-Id: References: <50126B83.3050201@cn.fujitsu.com> <50126F21.803@cn.fujitsu.com> In-Reply-To: <50126F21.803@cn.fujitsu.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: Wen Congyang 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 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. Thanks, Yasuaki Ishimatsu > + node_set_offline(nid); > + unregister_one_node(nid); > + } > + > arch_remove_memory(start, size); > out: > unlock_memory_hotplug(); >