diff options
| author | Steve French <sfrench@us.ibm.com> | 2005-11-29 20:56:07 -0800 |
|---|---|---|
| committer | Steve French <sfrench@us.ibm.com> | 2005-11-29 20:56:07 -0800 |
| commit | 606c0dafbe88102d64c1253caed8a2c36987070f (patch) | |
| tree | 23ce7b30341e71c6da8e0183d27e29167e833e26 /lib/genalloc.c | |
| parent | 6ab16d249513a50bef3f1b275cea6aa8d3f51832 (diff) | |
| parent | d2ef5ebb4c4fe141a82252d4db8d8521e6765c5a (diff) | |
Merge with /pub/scm/linux/kernel/git/torvalds/linux-2.6.git
Diffstat (limited to 'lib/genalloc.c')
| -rw-r--r-- | lib/genalloc.c | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/lib/genalloc.c b/lib/genalloc.c index d6d30d2e7166..9ce0a6a3b85a 100644 --- a/lib/genalloc.c +++ b/lib/genalloc.c @@ -95,12 +95,10 @@ unsigned long gen_pool_alloc(struct gen_pool *poolp, int size) if (size > max_chunk_size) return 0; - i = 0; - size = max(size, 1 << ALLOC_MIN_SHIFT); - s = roundup_pow_of_two(size); - - j = i; + i = fls(size - 1); + s = 1 << i; + j = i -= ALLOC_MIN_SHIFT; spin_lock_irqsave(&poolp->lock, flags); while (!h[j].next) { @@ -153,10 +151,10 @@ void gen_pool_free(struct gen_pool *poolp, unsigned long ptr, int size) if (size > max_chunk_size) return; - i = 0; - size = max(size, 1 << ALLOC_MIN_SHIFT); - s = roundup_pow_of_two(size); + i = fls(size - 1); + s = 1 << i; + i -= ALLOC_MIN_SHIFT; a = ptr; |
