version 1.128.2.5, 2007/07/29 11:34:47 |
version 1.128.2.6, 2007/08/20 21:27:37 |
Line 1615 pool_reclaim(struct pool *pp) |
|
Line 1615 pool_reclaim(struct pool *pp) |
|
* Drain pools, one at a time. |
* Drain pools, one at a time. |
* |
* |
* Note, we must never be called from an interrupt context. |
* Note, we must never be called from an interrupt context. |
|
* |
|
* XXX Pool can disappear while draining. |
*/ |
*/ |
void |
void |
pool_drain(void *arg) |
pool_drain(void *arg) |
Line 2170 pool_cache_destruct_object(struct pool_c |
|
Line 2172 pool_cache_destruct_object(struct pool_c |
|
pool_put(pc->pc_pool, object); |
pool_put(pc->pc_pool, object); |
} |
} |
|
|
|
/* |
|
* pool_do_cache_invalidate_grouplist: |
|
* |
|
* Invalidate a single grouplist and destruct all objects. |
|
* XXX This is too expensive. We should swap the list then |
|
* unlock. |
|
*/ |
static void |
static void |
pool_do_cache_invalidate_grouplist(struct pool_cache_grouplist *pcgsl, |
pool_do_cache_invalidate_grouplist(struct pool_cache_grouplist *pcgsl, |
struct pool_cache *pc, struct pool_pagelist *pq, |
struct pool_cache *pc, struct pool_pagelist *pq, |
struct pool_cache_grouplist *pcgdl) |
struct pool_cache_grouplist *pcgdl) |
{ |
{ |
struct pool_cache_group *pcg, *npcg; |
struct pool_cache_group *pcg; |
void *object; |
void *object; |
|
|
for (pcg = LIST_FIRST(pcgsl); pcg != NULL; pcg = npcg) { |
KASSERT(mutex_owned(&pc->pc_lock)); |
npcg = LIST_NEXT(pcg, pcg_list); |
KASSERT(mutex_owned(&pc->pc_pool->pr_lock)); |
|
|
|
while ((pcg = LIST_FIRST(pcgsl)) != NULL) { |
|
pc->pc_ngroups--; |
|
LIST_REMOVE(pcg, pcg_list); |
|
LIST_INSERT_HEAD(pcgdl, pcg, pcg_list); |
|
pc->pc_nitems -= pcg->pcg_avail; |
|
mutex_exit(&pc->pc_pool->pr_lock); |
|
mutex_exit(&pc->pc_lock); |
|
|
while (pcg->pcg_avail != 0) { |
while (pcg->pcg_avail != 0) { |
pc->pc_nitems--; |
|
object = pcg_get(pcg, NULL); |
object = pcg_get(pcg, NULL); |
if (pc->pc_dtor != NULL) |
if (pc->pc_dtor != NULL) |
(*pc->pc_dtor)(pc->pc_arg, object); |
(*pc->pc_dtor)(pc->pc_arg, object); |
|
mutex_enter(&pc->pc_pool->pr_lock); |
pool_do_put(pc->pc_pool, object, pq); |
pool_do_put(pc->pc_pool, object, pq); |
|
mutex_exit(&pc->pc_pool->pr_lock); |
} |
} |
pc->pc_ngroups--; |
|
LIST_REMOVE(pcg, pcg_list); |
mutex_enter(&pc->pc_lock); |
LIST_INSERT_HEAD(pcgdl, pcg, pcg_list); |
mutex_enter(&pc->pc_pool->pr_lock); |
} |
} |
} |
} |
|
|