lkml.org 
[lkml]   [2008]   [Apr]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] generic pool allocator: allow all chunks to be allocated.
Date
From: Bruce Schmid <duck@freescale.com>


gen_pool_alloc() doesn't allocate the last chunk in a pool.
This patch fixes that problem by correcting the calculation
of the number of the last bit in the bitmap.

Cc: Dean Nelson <dcn@sgi.com>
Signed-off-by: Bruce Schmid <duck@freescale.com>
---
lib/genalloc.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/lib/genalloc.c b/lib/genalloc.c
index f6d276d..ac00492 100644
--- a/lib/genalloc.c
+++ b/lib/genalloc.c
@@ -127,7 +127,7 @@ unsigned long gen_pool_alloc(struct gen_pool *pool, size_t size)
chunk = list_entry(_chunk, struct gen_pool_chunk, next_chunk);

end_bit = (chunk->end_addr - chunk->start_addr) >> order;
- end_bit -= nbits + 1;
+ end_bit -= (nbits - 1);

spin_lock_irqsave(&chunk->lock, flags);
bit = -1;
--
1.5.4


\
 
 \ /
  Last update: 2008-04-16 14:37    [W:0.044 / U:0.424 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site