version 1.74, 2002/03/09 18:06:55 |
version 1.76, 2002/03/13 10:57:18 |
Line 145 struct pool_item { |
|
Line 145 struct pool_item { |
|
/* The cache group pool. */ |
/* The cache group pool. */ |
static struct pool pcgpool; |
static struct pool pcgpool; |
|
|
/* The pool cache group. */ |
|
#define PCG_NOBJECTS 16 |
|
struct pool_cache_group { |
|
TAILQ_ENTRY(pool_cache_group) |
|
pcg_list; /* link in the pool cache's group list */ |
|
u_int pcg_avail; /* # available objects */ |
|
/* pointers to the objects */ |
|
void *pcg_objects[PCG_NOBJECTS]; |
|
}; |
|
|
|
static void pool_cache_reclaim(struct pool_cache *); |
static void pool_cache_reclaim(struct pool_cache *); |
|
|
static int pool_catchup(struct pool *); |
static int pool_catchup(struct pool *); |
Line 1048 pool_prime(struct pool *pp, int n) |
|
Line 1038 pool_prime(struct pool *pp, int n) |
|
{ |
{ |
struct pool_item_header *ph; |
struct pool_item_header *ph; |
caddr_t cp; |
caddr_t cp; |
int newpages, error = 0; |
int newpages; |
|
|
simple_lock(&pp->pr_slock); |
simple_lock(&pp->pr_slock); |
|
|
Line 1062 pool_prime(struct pool *pp, int n) |
|
Line 1052 pool_prime(struct pool *pp, int n) |
|
simple_lock(&pp->pr_slock); |
simple_lock(&pp->pr_slock); |
|
|
if (__predict_false(cp == NULL || ph == NULL)) { |
if (__predict_false(cp == NULL || ph == NULL)) { |
error = ENOMEM; |
|
if (cp != NULL) |
if (cp != NULL) |
pool_allocator_free(pp, cp); |
pool_allocator_free(pp, cp); |
break; |
break; |
Line 1198 pool_catchup(struct pool *pp) |
|
Line 1187 pool_catchup(struct pool *pp) |
|
void |
void |
pool_setlowat(struct pool *pp, int n) |
pool_setlowat(struct pool *pp, int n) |
{ |
{ |
int error; |
|
|
|
simple_lock(&pp->pr_slock); |
simple_lock(&pp->pr_slock); |
|
|
Line 1208 pool_setlowat(struct pool *pp, int n) |
|
Line 1196 pool_setlowat(struct pool *pp, int n) |
|
: roundup(n, pp->pr_itemsperpage) / pp->pr_itemsperpage; |
: roundup(n, pp->pr_itemsperpage) / pp->pr_itemsperpage; |
|
|
/* Make sure we're caught up with the newly-set low water mark. */ |
/* Make sure we're caught up with the newly-set low water mark. */ |
if (POOL_NEEDS_CATCHUP(pp) && (error = pool_catchup(pp) != 0)) { |
if (POOL_NEEDS_CATCHUP(pp) && pool_catchup(pp) != 0) { |
/* |
/* |
* XXX: Should we log a warning? Should we set up a timeout |
* XXX: Should we log a warning? Should we set up a timeout |
* to try again in a second or so? The latter could break |
* to try again in a second or so? The latter could break |