version 1.196, 2012/06/05 22:28:11 |
version 1.197, 2012/06/05 22:51:47 |
Line 1300 pool_sethardlimit(struct pool *pp, int n |
|
Line 1300 pool_sethardlimit(struct pool *pp, int n |
|
/* |
/* |
* Release all complete pages that have not been used recently. |
* Release all complete pages that have not been used recently. |
* |
* |
* Might be called from interrupt context. |
* Must not be called from interrupt context. |
*/ |
*/ |
int |
int |
pool_reclaim(struct pool *pp) |
pool_reclaim(struct pool *pp) |
Line 1311 pool_reclaim(struct pool *pp) |
|
Line 1311 pool_reclaim(struct pool *pp) |
|
bool klock; |
bool klock; |
int rv; |
int rv; |
|
|
if (cpu_intr_p() || cpu_softintr_p()) { |
KASSERT(!cpu_intr_p() && !cpu_softintr_p()); |
KASSERT(pp->pr_ipl != IPL_NONE); |
|
} |
|
|
|
if (pp->pr_drain_hook != NULL) { |
if (pp->pr_drain_hook != NULL) { |
/* |
/* |
Line 1387 pool_reclaim(struct pool *pp) |
|
Line 1385 pool_reclaim(struct pool *pp) |
|
} |
} |
|
|
/* |
/* |
* Drain pools, one at a time. This is a two stage process; |
* Drain pools, one at a time. The drained pool is returned within ppp. |
* drain_start kicks off a cross call to drain CPU-level caches |
|
* if the pool has an associated pool_cache. drain_end waits |
|
* for those cross calls to finish, and then drains the cache |
|
* (if any) and pool. |
|
* |
* |
* Note, must never be called from interrupt context. |
* Note, must never be called from interrupt context. |
*/ |
*/ |
void |
bool |
pool_drain_start(struct pool **ppp, uint64_t *wp) |
pool_drain(struct pool **ppp) |
{ |
{ |
|
bool reclaimed; |
struct pool *pp; |
struct pool *pp; |
|
|
KASSERT(!TAILQ_EMPTY(&pool_head)); |
KASSERT(!TAILQ_EMPTY(&pool_head)); |
Line 1422 pool_drain_start(struct pool **ppp, uint |
|
Line 1417 pool_drain_start(struct pool **ppp, uint |
|
pp->pr_refcnt++; |
pp->pr_refcnt++; |
mutex_exit(&pool_head_lock); |
mutex_exit(&pool_head_lock); |
|
|
/* If there is a pool_cache, drain CPU level caches. */ |
|
*ppp = pp; |
|
if (pp->pr_cache != NULL) { |
|
*wp = xc_broadcast(0, (xcfunc_t)pool_cache_transfer, |
|
pp->pr_cache, NULL); |
|
} |
|
} |
|
|
|
bool |
|
pool_drain_end(struct pool *pp, uint64_t where) |
|
{ |
|
bool reclaimed; |
|
|
|
if (pp == NULL) |
|
return false; |
|
|
|
KASSERT(pp->pr_refcnt > 0); |
|
|
|
/* Wait for remote draining to complete. */ |
|
if (pp->pr_cache != NULL) |
|
xc_wait(where); |
|
|
|
/* Drain the cache (if any) and pool.. */ |
/* Drain the cache (if any) and pool.. */ |
reclaimed = pool_reclaim(pp); |
reclaimed = pool_reclaim(pp); |
|
|
Line 1453 pool_drain_end(struct pool *pp, uint64_t |
|
Line 1426 pool_drain_end(struct pool *pp, uint64_t |
|
cv_broadcast(&pool_busy); |
cv_broadcast(&pool_busy); |
mutex_exit(&pool_head_lock); |
mutex_exit(&pool_head_lock); |
|
|
|
if (ppp != NULL) |
|
*ppp = pp; |
|
|
return reclaimed; |
return reclaimed; |
} |
} |
|
|