Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1759007Ab0FVR2x (ORCPT ); Tue, 22 Jun 2010 13:28:53 -0400 Received: from rcsinet10.oracle.com ([148.87.113.121]:33065 "EHLO rcsinet10.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758940Ab0FVR2o (ORCPT ); Tue, 22 Jun 2010 13:28:44 -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 11/25] x86,lmb: Add lmb_reserve_range/lmb_free_range Date: Tue, 22 Jun 2010 10:26:40 -0700 Message-Id: <1277227614-11581-12-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: acsinet15.oracle.com [141.146.126.227] X-CT-RefId: str=0001.0A090206.4C20F2AF.001F,ss=1,fgs=0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2083 Lines: 68 they are wrappers for core versions. they are taking start/end/name instead of base/size. will make x86 conversion more easy could add more debug print out -v2: change get_max_mapped() to lmb.default_alloc_limit according to Michael Ellerman and Ben change to lmb_reserve_range and lmb_free_range according to Michael Ellerman -v3: call check_and_double after reserve/free, so could avoid to use find_lmb_area. Suggested by Michael Ellerman Signed-off-by: Yinghai Lu --- arch/x86/include/asm/lmb.h | 3 +++ arch/x86/mm/lmb.c | 22 ++++++++++++++++++++++ 2 files changed, 25 insertions(+), 0 deletions(-) diff --git a/arch/x86/include/asm/lmb.h b/arch/x86/include/asm/lmb.h index e8207f8..70df84f 100644 --- a/arch/x86/include/asm/lmb.h +++ b/arch/x86/include/asm/lmb.h @@ -6,4 +6,7 @@ u64 lmb_find_in_range_size(u64 start, u64 *sizep, u64 align); void lmb_to_bootmem(u64 start, u64 end); +void lmb_reserve_range(u64 start, u64 end, char *name); +void lmb_free_range(u64 start, u64 end); + #endif diff --git a/arch/x86/mm/lmb.c b/arch/x86/mm/lmb.c index a959699..6b6cc58 100644 --- a/arch/x86/mm/lmb.c +++ b/arch/x86/mm/lmb.c @@ -116,3 +116,25 @@ void __init lmb_to_bootmem(u64 start, u64 end) lmb_reserve(__pa(lmb.reserved.regions), sizeof(struct lmb_region) * lmb.reserved.max); } #endif + +void __init lmb_reserve_range(u64 start, u64 end, char *name) +{ + if (start == end) + return; + + if (WARN_ONCE(start > end, "lmb_reserve_range: wrong range [%#llx, %#llx]\n", start, end)) + return; + + lmb_reserve(start, end - start); +} + +void __init lmb_free_range(u64 start, u64 end) +{ + if (start == end) + return; + + if (WARN_ONCE(start > end, "lmb_free_range: wrong range [%#llx, %#llx]\n", start, end)) + return; + + lmb_free(start, end - start); +} -- 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/