From bb9eedeff4ddc4550991eb4511003bda8672d6c4 Mon Sep 17 00:00:00 2001 From: Iliyan Malchev Date: Mon, 19 Oct 2009 14:25:17 -0700 Subject: [PATCH] bionic/linker: make the buddy allocator compute max_order on its own Signed-off-by: Iliyan Malchev --- linker/ba.c | 7 +++++++ linker/linker.c | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/linker/ba.c b/linker/ba.c index 8534919a3..db49c4b42 100644 --- a/linker/ba.c +++ b/linker/ba.c @@ -41,9 +41,16 @@ #define BA_START_ADDR(index) (BA_OFFSET(index) + ba->base) #define BA_LEN(index) ((1 << BA_ORDER(index)) * ba->min_alloc) +static unsigned long ba_order(struct ba *ba, unsigned long len); + void ba_init(struct ba *ba) { int i, index = 0; + + unsigned long max_order = ba_order(ba, ba->size); + if (ba->max_order == 0 || ba->max_order > max_order) + ba->max_order = max_order; + for (i = sizeof(ba->num_entries) * 8 - 1; i >= 0; i--) { if (ba->num_entries & 1<