Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751620Ab2KPLwB (ORCPT ); Fri, 16 Nov 2012 06:52:01 -0500 Received: from cn.fujitsu.com ([222.73.24.84]:55865 "EHLO song.cn.fujitsu.com" rhost-flags-OK-FAIL-OK-OK) by vger.kernel.org with ESMTP id S1751333Ab2KPLv7 (ORCPT ); Fri, 16 Nov 2012 06:51:59 -0500 X-IronPort-AV: E=Sophos;i="4.83,264,1352044800"; d="scan'208";a="6214984" From: Wen Congyang To: linux-kernel@vger.kernel.org, linux-mm@kvack.org Cc: Rob Landley , Andrew Morton , Yasuaki Ishimatsu , Lai Jiangshan , Jiang Liu , KOSAKI Motohiro , Minchan Kim , Mel Gorman , David Rientjes , Yinghai Lu , Rusty Russell , Wen Congyang Subject: [PART4 Patch v2 2/2] memory_hotplug: allow online/offline memory to result movable node Date: Fri, 16 Nov 2012 19:58:10 +0800 Message-Id: <1353067090-19468-3-git-send-email-wency@cn.fujitsu.com> X-Mailer: git-send-email 1.8.0 In-Reply-To: <1353067090-19468-1-git-send-email-wency@cn.fujitsu.com> References: <1353067090-19468-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/16 19:51:47, Serialize by Router on mailserver/fnst(Release 8.5.3|September 15, 2011) at 2012/11/16 19:51:49, Serialize complete at 2012/11/16 19:51:49 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2608 Lines: 71 From: Lai Jiangshan Now, memory management can handle movable node or nodes which don't have any normal memory, so we can dynamic configure and add movable node by: online a ZONE_MOVABLE memory from a previous offline node offline the last normal memory which result a non-normal-memory-node movable-node is very important for power-saving, hardware partitioning and high-available-system(hardware fault management). Signed-off-by: Lai Jiangshan Tested-by: Yasuaki Ishimatsu Signed-off-by: Wen Congyang --- mm/memory_hotplug.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c index d07c66f..4aceb03 100644 --- a/mm/memory_hotplug.c +++ b/mm/memory_hotplug.c @@ -589,11 +589,19 @@ static int online_pages_range(unsigned long start_pfn, unsigned long nr_pages, return 0; } +#ifdef CONFIG_MOVABLE_NODE +/* when CONFIG_MOVABLE_NODE, we allow online node don't have normal memory */ +static bool can_online_high_movable(struct zone *zone) +{ + return true; +} +#else /* #ifdef CONFIG_MOVABLE_NODE */ /* ensure every online node has NORMAL memory */ static bool can_online_high_movable(struct zone *zone) { return node_state(zone_to_nid(zone), N_NORMAL_MEMORY); } +#endif /* #ifdef CONFIG_MOVABLE_NODE */ /* check which state of node_states will be changed when online memory */ static void node_states_check_changes_online(unsigned long nr_pages, @@ -1097,6 +1105,13 @@ check_pages_isolated(unsigned long start_pfn, unsigned long end_pfn) return offlined; } +#ifdef CONFIG_MOVABLE_NODE +/* when CONFIG_MOVABLE_NODE, we allow online node don't have normal memory */ +static bool can_offline_normal(struct zone *zone, unsigned long nr_pages) +{ + return true; +} +#else /* #ifdef CONFIG_MOVABLE_NODE */ /* ensure the node has NORMAL memory if it is still online */ static bool can_offline_normal(struct zone *zone, unsigned long nr_pages) { @@ -1120,6 +1135,7 @@ static bool can_offline_normal(struct zone *zone, unsigned long nr_pages) */ return present_pages == 0; } +#endif /* #ifdef CONFIG_MOVABLE_NODE */ /* check which state of node_states will be changed when offline memory */ static void node_states_check_changes_offline(unsigned long nr_pages, -- 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/