From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753856AbbFDNMj (ORCPT ); Thu, 4 Jun 2015 09:12:39 -0400 Received: from szxga01-in.huawei.com ([58.251.152.64]:10829 "EHLO szxga01-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753503AbbFDNMh (ORCPT ); Thu, 4 Jun 2015 09:12:37 -0400 Message-ID: <55704B55.1020403@huawei.com> Date: Thu, 4 Jun 2015 20:57:57 +0800 From: Xishi Qiu User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:12.0) Gecko/20120428 Thunderbird/12.0.1 MIME-Version: 1.0 To: Xishi Qiu , Andrew Morton , , Yinghai Lu , "H. Peter Anvin" , Thomas Gleixner , , Xiexiuqi , Hanjun Guo , "Luck, Tony" CC: Linux MM , LKML Subject: [RFC PATCH 02/12] mm: introduce mirror_info References: <55704A7E.5030507@huawei.com> In-Reply-To: <55704A7E.5030507@huawei.com> Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 7bit X-Originating-IP: [10.177.25.179] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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]; +}; + +extern struct mirror_info mirror_info; +#endif + #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) -- 2.0.0