Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1759230Ab0FVRbk (ORCPT ); Tue, 22 Jun 2010 13:31:40 -0400 Received: from rcsinet10.oracle.com ([148.87.113.121]:33080 "EHLO rcsinet10.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758951Ab0FVR2s (ORCPT ); Tue, 22 Jun 2010 13:28:48 -0400 From: Yinghai Lu To: Ingo Molnar , Thomas Gleixner , "H. Peter Anvin" , Andrew Morton , David Miller , Benjamin Herrenschmidt Cc: Linus Torvalds , Johannes Weiner , linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org, Yinghai Lu Subject: [PATCH 15/25] x86, lmb: Add lmb_find_in_range_node() Date: Tue, 22 Jun 2010 10:26:44 -0700 Message-Id: <1277227614-11581-16-git-send-email-yinghai@kernel.org> X-Mailer: git-send-email 1.6.4.2 In-Reply-To: <1277227614-11581-1-git-send-email-yinghai@kernel.org> References: <1277227614-11581-1-git-send-email-yinghai@kernel.org> X-Auth-Type: Internal IP X-Source-IP: rcsinet13.oracle.com [148.87.113.125] X-CT-RefId: str=0001.0A090205.4C20F2B2.0091,ss=1,fgs=0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1914 Lines: 56 It can be used to find NODE_DATA for numa. Need to make sure early_node_map[] is filled before it is called, otherwise it will fallback to lmb_find_in_range(), with node range. Signed-off-by: Yinghai Lu --- arch/x86/include/asm/lmb.h | 1 + arch/x86/mm/lmb.c | 15 +++++++++++++++ 2 files changed, 16 insertions(+), 0 deletions(-) diff --git a/arch/x86/include/asm/lmb.h b/arch/x86/include/asm/lmb.h index 763fb52..02fe25d 100644 --- a/arch/x86/include/asm/lmb.h +++ b/arch/x86/include/asm/lmb.h @@ -14,5 +14,6 @@ int get_free_all_memory_range(struct range **rangep, int nodeid); void lmb_register_active_regions(int nid, unsigned long start_pfn, unsigned long last_pfn); u64 lmb_hole_size(u64 start, u64 end); +u64 lmb_find_in_range_node(int nid, u64 start, u64 end, u64 size, u64 align); #endif diff --git a/arch/x86/mm/lmb.c b/arch/x86/mm/lmb.c index b7e42bc..399d223 100644 --- a/arch/x86/mm/lmb.c +++ b/arch/x86/mm/lmb.c @@ -240,6 +240,21 @@ void __init lmb_free_range(u64 start, u64 end) } /* + * Need to call this function after lmb_register_active_regions, + * so early_node_map[] is filled already. + */ +u64 __init lmb_find_in_range_node(int nid, u64 start, u64 end, u64 size, u64 align) +{ + u64 addr; + addr = find_memory_core_early(nid, size, align, start, end); + if (addr != LMB_ERROR) + return addr; + + /* Fallback, should already have start end within node range */ + return lmb_find_in_range(start, end, size, align); +} + +/* * Finds an active region in the address range from start_pfn to last_pfn and * returns its range in ei_startpfn and ei_endpfn for the lmb entry. */ -- 1.6.4.2 -- 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/