From patchwork Wed Jan 16 08:14:18 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lin Feng X-Patchwork-Id: 212482 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 A6A012C012E for ; Wed, 16 Jan 2013 21:50:11 +1100 (EST) Received: from song.cn.fujitsu.com (unknown [222.73.24.84]) by ozlabs.org (Postfix) with ESMTP id E25052C0099 for ; Wed, 16 Jan 2013 19:15:30 +1100 (EST) X-IronPort-AV: E=Sophos;i="4.84,478,1355068800"; d="scan'208";a="6598687" Received: from unknown (HELO tang.cn.fujitsu.com) ([10.167.250.3]) by song.cn.fujitsu.com with ESMTP; 16 Jan 2013 16:13:22 +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 r0G8FNDC020948; Wed, 16 Jan 2013 16:15:26 +0800 Received: from linfeng-fedora.fnst.cn.fujitsu.com ([10.167.225.247]) by fnstmail02.fnst.cn.fujitsu.com (Lotus Domino Release 8.5.3) with ESMTP id 2013011616144196-956559 ; Wed, 16 Jan 2013 16:14:41 +0800 From: Lin Feng To: akpm@linux-foundation.org, mhocko@suse.cz, linux-mm@kvack.org, tglx@linutronix.de, mingo@redhat.com, hpa@zytor.com, jbeulich@suse.com, dhowells@redhat.com, wency@cn.fujitsu.com, isimatu.yasuaki@jp.fujitsu.com, paul.gortmaker@windriver.com, laijs@cn.fujitsu.com, kamezawa.hiroyu@jp.fujitsu.com, mel@csn.ul.ie, minchan@kernel.org, aquini@redhat.com, jiang.liu@huawei.com, tony.luck@intel.com, fenghua.yu@intel.com, benh@kernel.crashing.org, paulus@samba.org, schwidefsky@de.ibm.com, heiko.carstens@de.ibm.com, davem@davemloft.net, michael@ellerman.id.au, gerald.schaefer@de.ibm.com, gregkh@linuxfoundation.org Subject: [PATCH v3 1/2] memory-hotplug: introduce CONFIG_HAVE_BOOTMEM_INFO_NODE and revert register_page_bootmem_info_node() when platform not support Date: Wed, 16 Jan 2013 16:14:18 +0800 Message-Id: <1358324059-9608-2-git-send-email-linfeng@cn.fujitsu.com> X-Mailer: git-send-email 1.7.11.7 In-Reply-To: <1358324059-9608-1-git-send-email-linfeng@cn.fujitsu.com> References: <1358324059-9608-1-git-send-email-linfeng@cn.fujitsu.com> X-MIMETrack: Itemize by SMTP Server on mailserver/fnst(Release 8.5.3|September 15, 2011) at 2013/01/16 16:14:41, Serialize by Router on mailserver/fnst(Release 8.5.3|September 15, 2011) at 2013/01/16 16:14:42, Serialize complete at 2013/01/16 16:14:42 X-Mailman-Approved-At: Wed, 16 Jan 2013 21:49:11 +1100 Cc: linux-s390@vger.kernel.org, linux-ia64@vger.kernel.org, x86@kernel.org, linux-kernel@vger.kernel.org, tangchen@cn.fujitsu.com, linfeng@cn.fujitsu.com, sparclinux@vger.kernel.org, linux390@de.ibm.com, linuxppc-dev@lists.ozlabs.org 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" It's implemented by adding a new Kconfig option named CONFIG_HAVE_BOOTMEM_INFO_NODE, which will be automatically selected by memory-hotplug feature fully supported archs(currently only on x86_64). Reported-by: Michal Hocko Signed-off-by: Lin Feng --- ChangeLog v2->v3: - Rename the patch title to conform it's content. - Update memory_hotplug.h and remove the misleading TODO pointed out by Michal. ChangeLog v1->v2: - Add a Kconfig option named HAVE_BOOTMEM_INFO_NODE suggested by Michal, which will be automatically selected by supported archs(currently only on x86_64). --- arch/x86/mm/init_64.c | 2 +- include/linux/memory_hotplug.h | 6 ++++++ mm/Kconfig | 8 ++++++++ mm/memory_hotplug.c | 2 ++ 4 files changed, 17 insertions(+), 1 deletions(-) diff --git a/arch/x86/mm/init_64.c b/arch/x86/mm/init_64.c index 07d6966..b539015 100644 --- a/arch/x86/mm/init_64.c +++ b/arch/x86/mm/init_64.c @@ -1317,7 +1317,7 @@ vmemmap_populate(struct page *start_page, unsigned long size, int node) return 0; } -#ifdef CONFIG_MEMORY_HOTPLUG_SPARSE +#if defined(CONFIG_MEMORY_HOTPLUG_SPARSE) && defined(CONFIG_HAVE_BOOTMEM_INFO_NODE) void register_page_bootmem_memmap(unsigned long section_nr, struct page *start_page, unsigned long size) { diff --git a/include/linux/memory_hotplug.h b/include/linux/memory_hotplug.h index f60e728..69903cc 100644 --- a/include/linux/memory_hotplug.h +++ b/include/linux/memory_hotplug.h @@ -174,7 +174,13 @@ static inline void arch_refresh_nodedata(int nid, pg_data_t *pgdat) #endif /* CONFIG_NUMA */ #endif /* CONFIG_HAVE_ARCH_NODEDATA_EXTENSION */ +#ifdef CONFIG_HAVE_BOOTMEM_INFO_NODE extern void register_page_bootmem_info_node(struct pglist_data *pgdat); +#else +static inline void register_page_bootmem_info_node(struct pglist_data *pgdat) +{ +} +#endif extern void put_page_bootmem(struct page *page); extern void get_page_bootmem(unsigned long ingo, struct page *page, unsigned long type); diff --git a/mm/Kconfig b/mm/Kconfig index 278e3ab..f8c5799 100644 --- a/mm/Kconfig +++ b/mm/Kconfig @@ -162,10 +162,18 @@ config MOVABLE_NODE Say Y here if you want to hotplug a whole node. Say N here if you want kernel to use memory on all nodes evenly. +# +# Only be set on architectures that have completely implemented memory hotplug +# feature. If you are not sure, don't touch it. +# +config HAVE_BOOTMEM_INFO_NODE + def_bool n + # eventually, we can have this option just 'select SPARSEMEM' config MEMORY_HOTPLUG bool "Allow for memory hot-add" select MEMORY_ISOLATION + select HAVE_BOOTMEM_INFO_NODE if X86_64 depends on SPARSEMEM || X86_64_ACPI_NUMA depends on HOTPLUG && ARCH_ENABLE_MEMORY_HOTPLUG depends on (IA64 || X86 || PPC_BOOK3S_64 || SUPERH || S390) diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c index 8aa2b56..daf111f 100644 --- a/mm/memory_hotplug.c +++ b/mm/memory_hotplug.c @@ -189,6 +189,7 @@ static void register_page_bootmem_info_section(unsigned long start_pfn) } #endif +#ifdef CONFIG_HAVE_BOOTMEM_INFO_NODE void register_page_bootmem_info_node(struct pglist_data *pgdat) { unsigned long i, pfn, end_pfn, nr_pages; @@ -230,6 +231,7 @@ void register_page_bootmem_info_node(struct pglist_data *pgdat) register_page_bootmem_info_section(pfn); } } +#endif static void grow_zone_span(struct zone *zone, unsigned long start_pfn, unsigned long end_pfn)