| version 1.46, 2000/12/07 21:30:07 |
version 1.47, 2000/12/10 17:03:34 |
| Line 1683 pool_cache_put(struct pool_cache *pc, vo |
|
| Line 1683 pool_cache_put(struct pool_cache *pc, vo |
|
| |
|
| /* |
/* |
| * No empty groups to free the object to. Attempt to |
* No empty groups to free the object to. Attempt to |
| * allocate one. We don't unlock the cache here, since |
* allocate one. |
| * we never block. |
|
| */ |
*/ |
| |
simple_unlock(&pc->pc_slock); |
| pcg = pool_get(&pcgpool, PR_NOWAIT); |
pcg = pool_get(&pcgpool, PR_NOWAIT); |
| if (pcg != NULL) { |
if (pcg != NULL) { |
| memset(pcg, 0, sizeof(*pcg)); |
memset(pcg, 0, sizeof(*pcg)); |
| |
simple_lock(&pc->pc_slock); |
| TAILQ_INSERT_TAIL(&pc->pc_grouplist, pcg, pcg_list); |
TAILQ_INSERT_TAIL(&pc->pc_grouplist, pcg, pcg_list); |
| pc->pc_freeto = pcg; |
if (pc->pc_freeto == NULL) |
| |
pc->pc_freeto = pcg; |
| goto have_group; |
goto have_group; |
| } |
} |
| |
|
| simple_unlock(&pc->pc_slock); |
|
| |
|
| /* |
/* |
| * Unable to allocate a cache group; destruct the object |
* Unable to allocate a cache group; destruct the object |
| * and free it back to the pool. |
* and free it back to the pool. |
|
|
| pool_cache_reclaim(struct pool_cache *pc) |
pool_cache_reclaim(struct pool_cache *pc) |
| { |
{ |
| |
|
| /* |
simple_lock(&pc->pc_slock); |
| * We're locking in the opposite order (pool already |
|
| * locked in pool_reclaim()), so use a try-lock instead. |
|
| */ |
|
| |
|
| if (simple_lock_try(&pc->pc_slock) == 0) |
|
| return; |
|
| pool_cache_do_invalidate(pc, 1, pool_do_put); |
pool_cache_do_invalidate(pc, 1, pool_do_put); |
| simple_unlock(&pc->pc_slock); |
simple_unlock(&pc->pc_slock); |
| } |
} |