Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755002Ab2KZKtz (ORCPT ); Mon, 26 Nov 2012 05:49:55 -0500 Received: from cn.fujitsu.com ([222.73.24.84]:52169 "EHLO song.cn.fujitsu.com" rhost-flags-OK-FAIL-OK-OK) by vger.kernel.org with ESMTP id S1754760Ab2KZKtw (ORCPT ); Mon, 26 Nov 2012 05:49:52 -0500 X-IronPort-AV: E=Sophos;i="4.83,320,1352044800"; d="scan'208";a="6277342" From: Wen Congyang To: linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-pm@vger.kernel.org, linux-acpi@vger.kernel.org, x86@kernel.org Cc: Yasuaki Ishimatsu , David Rientjes , Jiang Liu , Minchan Kim , KOSAKI Motohiro , Andrew Morton , Mel Gorman , Thomas Gleixner , Ingo Molnar , "H. Peter Anvin" , Peter Zijlstra , Tang Chen , "Rafael J. Wysocki" , Len Brown , Lai Jiangshan , Wen Congyang Subject: [PATCH 2/5] memory-hotplug: export the function try_offline_node() Date: Mon, 26 Nov 2012 18:20:24 +0800 Message-Id: <1353925227-1877-3-git-send-email-wency@cn.fujitsu.com> X-Mailer: git-send-email 1.8.0 In-Reply-To: <1353925227-1877-1-git-send-email-wency@cn.fujitsu.com> References: <1353925227-1877-1-git-send-email-wency@cn.fujitsu.com> X-MIMETrack: Itemize by SMTP Server on mailserver/fnst(Release 8.5.3|September 15, 2011) at 2012/11/26 18:13:35, Serialize by Router on mailserver/fnst(Release 8.5.3|September 15, 2011) at 2012/11/26 18:13:39, Serialize complete at 2012/11/26 18:13:39 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2820 Lines: 79 The node will be offlined when all memory/cpu on the node have been hotremoved. So we need the function try_offline_node() in cpu-hotplug path. If the memory-hotplug is disabled, and cpu-hotplug is enabled 1. no memory no the node we don't online the node, and cpu's node is the nearest node. 2. the node contains some memory the node has been onlined, and cpu's node is still needed to migrate the sleep task on the cpu to the same node. So we do nothing in try_offline_node() in this case. Cc: Yasuaki Ishimatsu Cc: David Rientjes Cc: Jiang Liu Cc: Minchan Kim Cc: KOSAKI Motohiro Cc: Andrew Morton Cc: Mel Gorman Cc: Thomas Gleixner Cc: Ingo Molnar Cc: "H. Peter Anvin" Cc: Peter Zijlstra Cc: Tang Chen Signed-off-by: Wen Congyang --- include/linux/memory_hotplug.h | 2 ++ mm/memory_hotplug.c | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/include/linux/memory_hotplug.h b/include/linux/memory_hotplug.h index ad2dd17..48ece75 100644 --- a/include/linux/memory_hotplug.h +++ b/include/linux/memory_hotplug.h @@ -187,6 +187,7 @@ extern void get_page_bootmem(unsigned long ingo, struct page *page, void lock_memory_hotplug(void); void unlock_memory_hotplug(void); +extern void try_offline_node(int nid); #else /* ! CONFIG_MEMORY_HOTPLUG */ /* @@ -221,6 +222,7 @@ static inline void register_page_bootmem_info_node(struct pglist_data *pgdat) static inline void lock_memory_hotplug(void) {} static inline void unlock_memory_hotplug(void) {} +static inline void try_offline_node(int nid) {} #endif /* ! CONFIG_MEMORY_HOTPLUG */ diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c index 52db031..b7c30bb 100644 --- a/mm/memory_hotplug.c +++ b/mm/memory_hotplug.c @@ -1670,7 +1670,7 @@ static int check_cpu_on_node(void *data) } /* offline the node if all memory sections of this node are removed */ -static void try_offline_node(int nid) +void try_offline_node(int nid) { pg_data_t *pgdat = NODE_DATA(nid); unsigned long start_pfn = NODE_DATA(nid)->node_start_pfn; @@ -1720,6 +1720,7 @@ static void try_offline_node(int nid) arch_refresh_nodedata(nid, NULL); arch_free_nodedata(pgdat); } +EXPORT_SYMBOL(try_offline_node); int __ref remove_memory(int nid, u64 start, u64 size) { -- 1.8.0 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/