Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932723AbbFIHAR (ORCPT ); Tue, 9 Jun 2015 03:00:17 -0400 Received: from mgwkm01.jp.fujitsu.com ([202.219.69.168]:26469 "EHLO mgwkm01.jp.fujitsu.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752512AbbFIG7o (ORCPT ); Tue, 9 Jun 2015 02:59:44 -0400 X-Greylist: delayed 625 seconds by postgrey-1.27 at vger.kernel.org; Tue, 09 Jun 2015 02:59:43 EDT X-SecurityPolicyCheck: OK by SHieldMailChecker v2.3.2 X-SHieldMailCheckerPolicyVersion: FJ-ISEC-20150223 X-SHieldMailCheckerMailID: bf957130cd0246d6b49779288914dc0b Message-ID: <55768C56.9010604@jp.fujitsu.com> Date: Tue, 09 Jun 2015 15:48:54 +0900 From: Kamezawa Hiroyuki User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0 MIME-Version: 1.0 To: Xishi Qiu , Andrew Morton , nao.horiguchi@gmail.com, Yinghai Lu , "H. Peter Anvin" , Thomas Gleixner , mingo@elte.hu, Xiexiuqi , Hanjun Guo , "Luck, Tony" CC: Linux MM , LKML Subject: Re: [RFC PATCH 02/12] mm: introduce mirror_info References: <55704A7E.5030507@huawei.com> <55704B55.1020403@huawei.com> In-Reply-To: <55704B55.1020403@huawei.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-TM-AS-MML: disable Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3810 Lines: 129 On 2015/06/04 21:57, Xishi Qiu wrote: > This patch introduces a new struct called "mirror_info", it is used to storage > the mirror address range which reported by EFI or ACPI. > > TBD: call add_mirror_info() to fill it. > > Signed-off-by: Xishi Qiu > --- > arch/x86/mm/numa.c | 3 +++ > include/linux/mmzone.h | 15 +++++++++++++++ > mm/page_alloc.c | 33 +++++++++++++++++++++++++++++++++ > 3 files changed, 51 insertions(+) > > diff --git a/arch/x86/mm/numa.c b/arch/x86/mm/numa.c > index 4053bb5..781fd68 100644 > --- a/arch/x86/mm/numa.c > +++ b/arch/x86/mm/numa.c > @@ -619,6 +619,9 @@ static int __init numa_init(int (*init_func)(void)) > /* In case that parsing SRAT failed. */ > WARN_ON(memblock_clear_hotplug(0, ULLONG_MAX)); > numa_reset_distance(); > +#ifdef CONFIG_MEMORY_MIRROR > + memset(&mirror_info, 0, sizeof(mirror_info)); > +#endif > > ret = init_func(); > if (ret < 0) > diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h > index 54d74f6..1fae07b 100644 > --- a/include/linux/mmzone.h > +++ b/include/linux/mmzone.h > @@ -69,6 +69,21 @@ enum { > # define is_migrate_cma(migratetype) false > #endif > > +#ifdef CONFIG_MEMORY_MIRROR > +struct numa_mirror_info { > + int node; > + unsigned long start; > + unsigned long size; > +}; > + > +struct mirror_info { > + int count; > + struct numa_mirror_info info[MAX_NUMNODES]; > +}; MAX_NUMNODE may not be enough when the firmware cannot use contiguous address for mirroing. > + > +extern struct mirror_info mirror_info; > +#endif If this structure will not be updated after boot, read_mostly should be helpful. > + > #define for_each_migratetype_order(order, type) \ > for (order = 0; order < MAX_ORDER; order++) \ > for (type = 0; type < MIGRATE_TYPES; type++) > diff --git a/mm/page_alloc.c b/mm/page_alloc.c > index ebffa0e..41a95a7 100644 > --- a/mm/page_alloc.c > +++ b/mm/page_alloc.c > @@ -210,6 +210,10 @@ static char * const zone_names[MAX_NR_ZONES] = { > int min_free_kbytes = 1024; > int user_min_free_kbytes = -1; > > +#ifdef CONFIG_MEMORY_MIRROR > +struct mirror_info mirror_info; > +#endif > + > static unsigned long __meminitdata nr_kernel_pages; > static unsigned long __meminitdata nr_all_pages; > static unsigned long __meminitdata dma_reserve; > @@ -545,6 +549,31 @@ static inline int page_is_buddy(struct page *page, struct page *buddy, > return 0; > } > > +#ifdef CONFIG_MEMORY_MIRROR > +static void __init add_mirror_info(int node, > + unsigned long start, unsigned long size) > +{ > + mirror_info.info[mirror_info.count].node = node; > + mirror_info.info[mirror_info.count].start = start; > + mirror_info.info[mirror_info.count].size = size; > + > + mirror_info.count++; > +} > + > +static void __init print_mirror_info(void) > +{ > + int i; > + > + printk("Mirror info\n"); > + for (i = 0; i < mirror_info.count; i++) > + printk(" node %3d: [mem %#010lx-%#010lx]\n", > + mirror_info.info[i].node, > + mirror_info.info[i].start, > + mirror_info.info[i].start + > + mirror_info.info[i].size - 1); > +} > +#endif > + > /* > * Freeing function for a buddy system allocator. > * > @@ -5438,6 +5467,10 @@ void __init free_area_init_nodes(unsigned long *max_zone_pfn) > (u64)zone_movable_pfn[i] << PAGE_SHIFT); > } > > +#ifdef CONFIG_MEMORY_MIRROR > + print_mirror_info(); > +#endif > + > /* Print out the early node map */ > pr_info("Early memory node ranges\n"); > for_each_mem_pfn_range(i, MAX_NUMNODES, &start_pfn, &end_pfn, &nid) > -- 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/