From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from psmtp.com (na3sys010amx120.postini.com [74.125.245.120]) by kanga.kvack.org (Postfix) with SMTP id 068D86B0070 for ; Wed, 3 Oct 2012 06:11:55 -0400 (EDT) Received: from m4.gw.fujitsu.co.jp (unknown [10.0.50.74]) by fgwmail5.fujitsu.co.jp (Postfix) with ESMTP id 8D4EA3EE0BC for ; Wed, 3 Oct 2012 19:11:54 +0900 (JST) Received: from smail (m4 [127.0.0.1]) by outgoing.m4.gw.fujitsu.co.jp (Postfix) with ESMTP id 757EE45DE4E for ; Wed, 3 Oct 2012 19:11:54 +0900 (JST) Received: from s4.gw.fujitsu.co.jp (s4.gw.fujitsu.co.jp [10.0.50.94]) by m4.gw.fujitsu.co.jp (Postfix) with ESMTP id 5FFC345DE4D for ; Wed, 3 Oct 2012 19:11:54 +0900 (JST) Received: from s4.gw.fujitsu.co.jp (localhost.localdomain [127.0.0.1]) by s4.gw.fujitsu.co.jp (Postfix) with ESMTP id 4FEF21DB8037 for ; Wed, 3 Oct 2012 19:11:54 +0900 (JST) Received: from g01jpexchkw04.g01.fujitsu.local (g01jpexchkw04.g01.fujitsu.local [10.0.194.43]) by s4.gw.fujitsu.co.jp (Postfix) with ESMTP id 0CD951DB802F for ; Wed, 3 Oct 2012 19:11:54 +0900 (JST) Message-ID: <506C0F53.5030500@jp.fujitsu.com> Date: Wed, 3 Oct 2012 19:11:31 +0900 From: Yasuaki Ishimatsu MIME-Version: 1.0 Subject: [PATCH 4/4] acpi,memory-hotplug : store the node id in acpi_memory_device References: <506C0AE8.40702@jp.fujitsu.com> In-Reply-To: <506C0AE8.40702@jp.fujitsu.com> Content-Type: text/plain; charset="ISO-2022-JP" Content-Transfer-Encoding: 7bit Sender: owner-linux-mm@kvack.org List-ID: To: x86@kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, linux-acpi@vger.kernel.org Cc: rientjes@google.com, liuj97@gmail.com, len.brown@intel.com, cl@linux.com, minchan.kim@gmail.com, akpm@linux-foundation.org, kosaki.motohiro@jp.fujitsu.com, wency@cn.fujitsu.com From: Wen Congyang The memory device has only one node id. Store the node id when enable the memory device, and we can reuse it when removing the memory device. 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: Yasuaki Ishimatsu Signed-off-by: Wen Congyang Signed-off-by: Yasuaki Ishimatsu --- drivers/acpi/acpi_memhotplug.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) Index: linux-3.6/drivers/acpi/acpi_memhotplug.c =================================================================== --- linux-3.6.orig/drivers/acpi/acpi_memhotplug.c 2012-10-03 19:03:26.818401966 +0900 +++ linux-3.6/drivers/acpi/acpi_memhotplug.c 2012-10-03 19:08:38.804604700 +0900 @@ -83,6 +83,7 @@ struct acpi_memory_info { struct acpi_memory_device { struct acpi_device * device; unsigned int state; /* State of the memory device */ + int nid; struct list_head res_list; }; @@ -256,6 +257,9 @@ static int acpi_memory_enable_device(str info->enabled = 1; num_enabled++; } + + mem_device->nid = node; + if (!num_enabled) { printk(KERN_ERR PREFIX "add_memory failed\n"); mem_device->state = MEMORY_INVALID_STATE; @@ -310,9 +314,7 @@ static int acpi_memory_remove_memory(str { int result; struct acpi_memory_info *info, *n; - int node; - - node = acpi_get_node(mem_device->device->handle); + int node = mem_device->nid; list_for_each_entry_safe(info, n, &mem_device->res_list, list) { if (!info->enabled) @@ -322,9 +324,6 @@ static int acpi_memory_remove_memory(str if (result) return result; - if (node < 0) - node = memory_add_physaddr_to_nid(info->start_addr); - result = remove_memory(node, info->start_addr, info->length); if (result) return result; -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: email@kvack.org