version 1.169, 2008/08/11 02:48:42 |
version 1.173, 2009/08/29 00:09:02 |
Line 69 __KERNEL_RCSID(0, "$NetBSD$"); |
|
Line 69 __KERNEL_RCSID(0, "$NetBSD$"); |
|
*/ |
*/ |
|
|
/* List of all pools */ |
/* List of all pools */ |
TAILQ_HEAD(,pool) pool_head = TAILQ_HEAD_INITIALIZER(pool_head); |
static TAILQ_HEAD(, pool) pool_head = TAILQ_HEAD_INITIALIZER(pool_head); |
|
|
/* Private pool for page header structures */ |
/* Private pool for page header structures */ |
#define PHPOOL_MAX 8 |
#define PHPOOL_MAX 8 |
Line 2528 pool_cache_put_slow(pool_cache_cpu_t *cc |
|
Line 2528 pool_cache_put_slow(pool_cache_cpu_t *cc |
|
KASSERT(cc->cc_previous->pcg_avail == cc->cc_previous->pcg_size); |
KASSERT(cc->cc_previous->pcg_avail == cc->cc_previous->pcg_size); |
|
|
pc = cc->cc_cache; |
pc = cc->cc_cache; |
|
pcg = NULL; |
cc->cc_misses++; |
cc->cc_misses++; |
|
|
|
/* |
|
* If there are no empty groups in the cache then allocate one |
|
* while still unlocked. |
|
*/ |
|
if (__predict_false(pc->pc_emptygroups == NULL)) { |
|
if (__predict_true(!pool_cache_disable)) { |
|
pcg = pool_get(pc->pc_pcgpool, PR_NOWAIT); |
|
} |
|
if (__predict_true(pcg != NULL)) { |
|
pcg->pcg_avail = 0; |
|
pcg->pcg_size = pc->pc_pcgsize; |
|
} |
|
} |
|
|
/* Lock the cache. */ |
/* Lock the cache. */ |
if (__predict_false(!mutex_tryenter(&pc->pc_lock))) { |
if (__predict_false(!mutex_tryenter(&pc->pc_lock))) { |
ncsw = curlwp->l_ncsw; |
ncsw = curlwp->l_ncsw; |
Line 2542 pool_cache_put_slow(pool_cache_cpu_t *cc |
|
Line 2557 pool_cache_put_slow(pool_cache_cpu_t *cc |
|
*/ |
*/ |
if (__predict_false(curlwp->l_ncsw != ncsw)) { |
if (__predict_false(curlwp->l_ncsw != ncsw)) { |
mutex_exit(&pc->pc_lock); |
mutex_exit(&pc->pc_lock); |
|
if (pcg != NULL) { |
|
pool_put(pc->pc_pcgpool, pcg); |
|
} |
return true; |
return true; |
} |
} |
} |
} |
|
|
/* If there are no empty groups in the cache then allocate one. */ |
/* If there are no empty groups in the cache then allocate one. */ |
if (__predict_false((pcg = pc->pc_emptygroups) == NULL)) { |
if (pcg == NULL && pc->pc_emptygroups != NULL) { |
if (__predict_true(!pool_cache_disable)) { |
pcg = pc->pc_emptygroups; |
pcg = pool_get(pc->pc_pcgpool, PR_NOWAIT); |
|
} |
|
if (__predict_true(pcg != NULL)) { |
|
pcg->pcg_avail = 0; |
|
pcg->pcg_size = pc->pc_pcgsize; |
|
} |
|
} else { |
|
pc->pc_emptygroups = pcg->pcg_next; |
pc->pc_emptygroups = pcg->pcg_next; |
pc->pc_nempty--; |
pc->pc_nempty--; |
} |
} |
Line 2610 pool_cache_put_paddr(pool_cache_t pc, vo |
|
Line 2621 pool_cache_put_paddr(pool_cache_t pc, vo |
|
pcg_t *pcg; |
pcg_t *pcg; |
int s; |
int s; |
|
|
|
KASSERT(object != NULL); |
FREECHECK_IN(&pc->pc_freecheck, object); |
FREECHECK_IN(&pc->pc_freecheck, object); |
|
|
/* Lock out interrupts and disable preemption. */ |
/* Lock out interrupts and disable preemption. */ |
|
|
if (pool_in_cg(pp, cc->cc_current, addr) || |
if (pool_in_cg(pp, cc->cc_current, addr) || |
pool_in_cg(pp, cc->cc_previous, addr)) { |
pool_in_cg(pp, cc->cc_previous, addr)) { |
struct cpu_info *ci = |
struct cpu_info *ci = |
cpu_lookup_byindex(i); |
cpu_lookup(i); |
|
|
incpucache = true; |
incpucache = true; |
snprintf(cpucachestr, |
snprintf(cpucachestr, |