[lkml]   [2010]   [Jul]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
Patch in this message
Subject[PATCH 07/23] lmb: Add lmb_find_in_range()
it is a wrapper for lmb_find_base

make it more easy for x86 to use lmb. ( rebase )
x86 early_res is using find/reserve pattern instead of alloc.

keep it in weak version, so later We can use x86 own version if needed.
also We need it in lib/lmb.c, so one caller mm/page_alloc.c could get compiled

-v2: Change name to lmb_find_in_range() according to Michael Ellerman
-v3: Add generic weak version __lmb_find_in_range()
so keep the path for fallback to x86 version that handle from low
-v4: use 0 for failing path
-v5: use LMB_ERROR again
-v6: remove __lmb_find_in_range()

Signed-off-by: Yinghai Lu <>
include/linux/lmb.h | 2 ++
lib/lmb.c | 8 ++++++++
2 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/include/linux/lmb.h b/include/linux/lmb.h
index bdb3d46..4af450b 100644
--- a/include/linux/lmb.h
+++ b/include/linux/lmb.h
@@ -48,6 +48,8 @@ extern struct lmb_region lmb_reserved_init_regions[];
#define lmb_dbg(fmt, ...) \
if (lmb_debug) printk(KERN_INFO pr_fmt(fmt), ##__VA_ARGS__)

+u64 lmb_find_in_range(u64 start, u64 end, u64 size, u64 align);
extern void __init lmb_init(void);
extern void __init lmb_analyze(void);
extern long lmb_add(phys_addr_t base, phys_addr_t size);
diff --git a/lib/lmb.c b/lib/lmb.c
index 66bf0b0..87b3801 100644
--- a/lib/lmb.c
+++ b/lib/lmb.c
@@ -156,6 +156,14 @@ static phys_addr_t __init lmb_find_base(phys_addr_t size, phys_addr_t align,
return LMB_ERROR;

+ * Find a free area with specified alignment in a specific range.
+ */
+u64 __init __weak lmb_find_in_range(u64 start, u64 end, u64 size, u64 align)
+ return lmb_find_base(size, align, start, end);
static void __init_lmb lmb_remove_region(struct lmb_type *type, unsigned long r)
unsigned long i;

 \ /
  Last update: 2010-07-04 09:07    [W:0.130 / U:18.824 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site