From patchwork Tue Nov 27 10:00:16 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [v4, 06/12] memory-hotplug: unregister memory section on SPARSEMEM_VMEMMAP Date: Tue, 27 Nov 2012 00:00:16 -0000 From: Wen Congyang X-Patchwork-Id: 202155 Message-Id: <1354010422-19648-7-git-send-email-wency@cn.fujitsu.com> To: x86@kernel.org, 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, sparclinux@vger.kernel.org Cc: Len Brown , Wen Congyang , Jianguo Wu , Yasuaki Ishimatsu , paulus@samba.org, Minchan Kim , KOSAKI Motohiro , David Rientjes , Christoph Lameter , Andrew Morton , Jiang Liu From: Yasuaki Ishimatsu Currently __remove_section for SPARSEMEM_VMEMMAP does nothing. But even if we use SPARSEMEM_VMEMMAP, we can unregister the memory_section. So the patch add unregister_memory_section() into __remove_section(). CC: David Rientjes CC: Jiang Liu CC: Len Brown CC: Christoph Lameter Cc: Minchan Kim CC: Andrew Morton CC: KOSAKI Motohiro Signed-off-by: Yasuaki Ishimatsu Signed-off-by: Wen Congyang Reviewed-by: Tang Chen --- mm/memory_hotplug.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c index e741732..171610d 100644 --- a/mm/memory_hotplug.c +++ b/mm/memory_hotplug.c @@ -279,11 +279,14 @@ static int __meminit __add_section(int nid, struct zone *zone, #ifdef CONFIG_SPARSEMEM_VMEMMAP static int __remove_section(struct zone *zone, struct mem_section *ms) { - /* - * XXX: Freeing memmap with vmemmap is not implement yet. - * This should be removed later. - */ - return -EBUSY; + int ret = -EINVAL; + + if (!valid_section(ms)) + return ret; + + ret = unregister_memory_section(ms); + + return ret; } #else static int __remove_section(struct zone *zone, struct mem_section *ms)