From patchwork Tue Jan 22 11:45:53 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tang Chen X-Patchwork-Id: 214526 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from ozlabs.org (localhost [IPv6:::1]) by ozlabs.org (Postfix) with ESMTP id 19A6F2C0AED for ; Tue, 22 Jan 2013 22:49:05 +1100 (EST) Received: from song.cn.fujitsu.com (unknown [222.73.24.84]) by ozlabs.org (Postfix) with ESMTP id 071FA2C0203 for ; Tue, 22 Jan 2013 22:46:49 +1100 (EST) X-IronPort-AV: E=Sophos;i="4.84,514,1355068800"; d="scan'208";a="6628484" Received: from unknown (HELO tang.cn.fujitsu.com) ([10.167.250.3]) by song.cn.fujitsu.com with ESMTP; 22 Jan 2013 19:44:40 +0800 Received: from fnstmail02.fnst.cn.fujitsu.com (tang.cn.fujitsu.com [127.0.0.1]) by tang.cn.fujitsu.com (8.14.3/8.13.1) with ESMTP id r0MBkj2P020816; Tue, 22 Jan 2013 19:46:45 +0800 Received: from tangchen.fnst.cn.fujitsu.com ([10.167.225.117]) by fnstmail02.fnst.cn.fujitsu.com (Lotus Domino Release 8.5.3) with ESMTP id 2013012219455162-1091875 ; Tue, 22 Jan 2013 19:45:51 +0800 From: Tang Chen To: akpm@linux-foundation.org, rjw@sisk.pl, len.brown@intel.com, mingo@redhat.com, tglx@linutronix.de, minchan.kim@gmail.com, rientjes@google.com, benh@kernel.crashing.org, paulus@samba.org, cl@linux.com, kosaki.motohiro@jp.fujitsu.com, isimatu.yasuaki@jp.fujitsu.com, wujianguo@huawei.com, wency@cn.fujitsu.com, hpa@zytor.com, linfeng@cn.fujitsu.com, laijs@cn.fujitsu.com, mgorman@suse.de, yinghai@kernel.org, glommer@parallels.com, jiang.liu@huawei.com, julian.calaby@gmail.com, sfr@canb.auug.org.au Subject: [PATCH Bug fix 2/5] memory-hotplug: export the function try_offline_node() Date: Tue, 22 Jan 2013 19:45:53 +0800 Message-Id: <1358855156-6126-3-git-send-email-tangchen@cn.fujitsu.com> X-Mailer: git-send-email 1.7.10.1 In-Reply-To: <1358855156-6126-1-git-send-email-tangchen@cn.fujitsu.com> References: <1358855156-6126-1-git-send-email-tangchen@cn.fujitsu.com> X-MIMETrack: Itemize by SMTP Server on mailserver/fnst(Release 8.5.3|September 15, 2011) at 2013/01/22 19:45:51, Serialize by Router on mailserver/fnst(Release 8.5.3|September 15, 2011) at 2013/01/22 19:45:52, Serialize complete at 2013/01/22 19:45:52 Cc: linux-acpi@vger.kernel.org, Mel Gorman , x86@kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, Peter Zijlstra , linuxppc-dev@lists.ozlabs.org, Jiang Liu X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Sender: "Linuxppc-dev" From: Wen Congyang 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 Signed-off-by: Tang Chen --- include/linux/memory_hotplug.h | 2 ++ mm/memory_hotplug.c | 3 ++- 2 files changed, 4 insertions(+), 1 deletions(-) diff --git a/include/linux/memory_hotplug.h b/include/linux/memory_hotplug.h index 69903cc..0b2878e 100644 --- a/include/linux/memory_hotplug.h +++ b/include/linux/memory_hotplug.h @@ -193,6 +193,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 */ /* @@ -227,6 +228,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 f0dc9ad..edd1773 100644 --- a/mm/memory_hotplug.c +++ b/mm/memory_hotplug.c @@ -1703,7 +1703,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 = pgdat->node_start_pfn; @@ -1759,6 +1759,7 @@ static void try_offline_node(int nid) */ memset(pgdat, 0, sizeof(*pgdat)); } +EXPORT_SYMBOL(try_offline_node); int __ref remove_memory(int nid, u64 start, u64 size) {