| version 1.112.6.1, 2006/03/28 09:42:26 |
version 1.112.6.2, 2006/05/24 15:50:41 |
|
|
| pool_init(struct pool *pp, size_t size, u_int align, u_int ioff, int flags, |
pool_init(struct pool *pp, size_t size, u_int align, u_int ioff, int flags, |
| const char *wchan, struct pool_allocator *palloc) |
const char *wchan, struct pool_allocator *palloc) |
| { |
{ |
| int off, slack; |
#ifdef DEBUG |
| |
struct pool *pp1; |
| |
#endif |
| size_t trysize, phsize; |
size_t trysize, phsize; |
| int s; |
int off, slack, s; |
| |
|
| KASSERT((1UL << (CHAR_BIT * sizeof(pool_item_freelist_t))) - 2 >= |
KASSERT((1UL << (CHAR_BIT * sizeof(pool_item_freelist_t))) - 2 >= |
| PHPOOL_FREELIST_NELEM(PHPOOL_MAX - 1)); |
PHPOOL_FREELIST_NELEM(PHPOOL_MAX - 1)); |
| |
|
| |
#ifdef DEBUG |
| |
/* |
| |
* Check that the pool hasn't already been initialised and |
| |
* added to the list of all pools. |
| |
*/ |
| |
LIST_FOREACH(pp1, &pool_head, pr_poollist) { |
| |
if (pp == pp1) |
| |
panic("pool_init: pool %s already initialised", |
| |
wchan); |
| |
} |
| |
#endif |
| |
|
| #ifdef POOL_DIAGNOSTIC |
#ifdef POOL_DIAGNOSTIC |
| /* |
/* |
| * Always log if POOL_DIAGNOSTIC is defined. |
* Always log if POOL_DIAGNOSTIC is defined. |
| Line 1220 pool_grow(struct pool *pp, int flags) |
|
| Line 1234 pool_grow(struct pool *pp, int flags) |
|
| simple_lock(&pp->pr_slock); |
simple_lock(&pp->pr_slock); |
| pool_prime_page(pp, cp, ph); |
pool_prime_page(pp, cp, ph); |
| pp->pr_npagealloc++; |
pp->pr_npagealloc++; |
| pp->pr_minpages++; |
|
| return 0; |
return 0; |
| } |
} |
| |
|
| Line 1530 pool_drain(void *arg) |
|
| Line 1543 pool_drain(void *arg) |
|
| drainpp = LIST_NEXT(pp, pr_poollist); |
drainpp = LIST_NEXT(pp, pr_poollist); |
| } |
} |
| simple_unlock(&pool_head_slock); |
simple_unlock(&pool_head_slock); |
| pool_reclaim(pp); |
if (pp) |
| |
pool_reclaim(pp); |
| splx(s); |
splx(s); |
| } |
} |
| |
|