generic pool allocator: allow all chunks to be allocated.
PATCH 1/1 generic pool allocator: allow all chunks to be allocated.
From: Bruce Schmid <[email protected]>
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 <[email protected]>
Signed-off-by Bruce Schmid <[email protected]>
--- lib/genalloc.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
lib/genalloc.c +1 -1
@@ -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 ;
Signature · 1 line
1.5.4
Quoted 5 lines · Duck
From: Bruce Schmid <[email protected]>
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.
Indeed it doesn't allocate the last bit. I ran a quick test with and without your patch and your patch does fix the problem.
Acked-by Dean Nelson <[email protected]>