Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754091Ab3FOBA1 (ORCPT ); Fri, 14 Jun 2013 21:00:27 -0400 Received: from userp1040.oracle.com ([156.151.31.81]:17638 "EHLO userp1040.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753176Ab3FOA5D (ORCPT ); Fri, 14 Jun 2013 20:57:03 -0400 From: Yinghai Lu To: "H. Peter Anvin" Cc: Thomas Gleixner , Ingo Molnar , Andrew Morton , Tejun Heo , Thomas Renninger , Tang Chen , linux-kernel@vger.kernel.org, Yinghai Lu Subject: [PATCH v5 14/22] x86, mm, numa: Set memblock nid later Date: Fri, 14 Jun 2013 17:56:32 -0700 Message-Id: <1371257800-11720-15-git-send-email-yinghai@kernel.org> X-Mailer: git-send-email 1.8.1.4 In-Reply-To: <1371257800-11720-1-git-send-email-yinghai@kernel.org> References: <1371257800-11720-1-git-send-email-yinghai@kernel.org> X-Source-IP: ucsinet21.oracle.com [156.151.31.93] Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2491 Lines: 81 For the separation, we need to set memblock nid later, as it could change memblock array, and possible doube memblock.memory array that will need to allocate buffer. Only set memblock nid one time for successful path. Also rename numa_register_memblks to numa_check_memblks() after move out code for setting memblock nid. Signed-off-by: Yinghai Lu Reviewed-by: Tang Chen Tested-by: Tang Chen --- arch/x86/mm/numa.c | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/arch/x86/mm/numa.c b/arch/x86/mm/numa.c index cff565a..e448b6f 100644 --- a/arch/x86/mm/numa.c +++ b/arch/x86/mm/numa.c @@ -534,10 +534,9 @@ static unsigned long __init node_map_pfn_alignment(struct numa_meminfo *mi) } #endif -static int __init numa_register_memblks(struct numa_meminfo *mi) +static int __init numa_check_memblks(struct numa_meminfo *mi) { unsigned long pfn_align; - int i; /* Account for nodes with cpus and no memory */ node_possible_map = numa_nodes_parsed; @@ -560,11 +559,6 @@ static int __init numa_register_memblks(struct numa_meminfo *mi) return -EINVAL; } - for (i = 0; i < mi->nr_blks; i++) { - struct numa_memblk *mb = &mi->blk[i]; - memblock_set_node(mb->start, mb->end - mb->start, mb->nid); - } - return 0; } @@ -601,7 +595,6 @@ static int __init numa_init(int (*init_func)(void)) nodes_clear(numa_nodes_parsed); nodes_clear(node_possible_map); memset(&numa_meminfo, 0, sizeof(numa_meminfo)); - WARN_ON(memblock_set_node(0, ULLONG_MAX, MAX_NUMNODES)); numa_reset_distance(); ret = init_func(); @@ -613,7 +606,7 @@ static int __init numa_init(int (*init_func)(void)) numa_emulation(&numa_meminfo, numa_distance_cnt); - ret = numa_register_memblks(&numa_meminfo); + ret = numa_check_memblks(&numa_meminfo); if (ret < 0) return ret; @@ -676,6 +669,11 @@ void __init x86_numa_init(void) early_x86_numa_init(); + for (i = 0; i < mi->nr_blks; i++) { + struct numa_memblk *mb = &mi->blk[i]; + memblock_set_node(mb->start, mb->end - mb->start, mb->nid); + } + /* Finally register nodes. */ for_each_node_mask(nid, node_possible_map) { u64 start = PFN_PHYS(max_pfn); -- 1.8.1.4 -- 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/