| version 1.174, 2009/09/13 18:45:11 |
version 1.175, 2009/10/08 21:54:45 |
| Line 188 static bool pool_cache_get_slow(pool_cac |
|
| Line 188 static bool pool_cache_get_slow(pool_cac |
|
| void **, paddr_t *, int); |
void **, paddr_t *, int); |
| static void pool_cache_cpu_init1(struct cpu_info *, pool_cache_t); |
static void pool_cache_cpu_init1(struct cpu_info *, pool_cache_t); |
| static void pool_cache_invalidate_groups(pool_cache_t, pcg_t *); |
static void pool_cache_invalidate_groups(pool_cache_t, pcg_t *); |
| |
static void pool_cache_invalidate_cpu(pool_cache_t, u_int); |
| static void pool_cache_xcall(pool_cache_t); |
static void pool_cache_xcall(pool_cache_t); |
| |
|
| static int pool_catchup(struct pool *); |
static int pool_catchup(struct pool *); |
|
|
| pool_cache_destroy(pool_cache_t pc) |
pool_cache_destroy(pool_cache_t pc) |
| { |
{ |
| struct pool *pp = &pc->pc_pool; |
struct pool *pp = &pc->pc_pool; |
| pool_cache_cpu_t *cc; |
u_int i; |
| pcg_t *pcg; |
|
| int i; |
|
| |
|
| /* Remove it from the global list. */ |
/* Remove it from the global list. */ |
| mutex_enter(&pool_head_lock); |
mutex_enter(&pool_head_lock); |
| Line 2142 pool_cache_destroy(pool_cache_t pc) |
|
| Line 2141 pool_cache_destroy(pool_cache_t pc) |
|
| mutex_exit(&pp->pr_lock); |
mutex_exit(&pp->pr_lock); |
| |
|
| /* Destroy per-CPU data */ |
/* Destroy per-CPU data */ |
| for (i = 0; i < MAXCPUS; i++) { |
for (i = 0; i < MAXCPUS; i++) |
| if ((cc = pc->pc_cpus[i]) == NULL) |
pool_cache_invalidate_cpu(pc, i); |
| continue; |
|
| if ((pcg = cc->cc_current) != &pcg_dummy) { |
|
| pcg->pcg_next = NULL; |
|
| pool_cache_invalidate_groups(pc, pcg); |
|
| } |
|
| if ((pcg = cc->cc_previous) != &pcg_dummy) { |
|
| pcg->pcg_next = NULL; |
|
| pool_cache_invalidate_groups(pc, pcg); |
|
| } |
|
| if (cc != &pc->pc_cpu0) |
|
| pool_put(&cache_cpu_pool, cc); |
|
| } |
|
| |
|
| /* Finally, destroy it. */ |
/* Finally, destroy it. */ |
| mutex_destroy(&pc->pc_lock); |
mutex_destroy(&pc->pc_lock); |
| Line 2325 pool_cache_invalidate(pool_cache_t pc) |
|
| Line 2312 pool_cache_invalidate(pool_cache_t pc) |
|
| pool_cache_invalidate_groups(pc, part); |
pool_cache_invalidate_groups(pc, part); |
| } |
} |
| |
|
| |
/* |
| |
* pool_cache_invalidate_local: |
| |
* |
| |
* Invalidate all local ('current CPU') cached objects in |
| |
* pool cache. |
| |
* It is caller's responsibility to ensure that no operation is |
| |
* taking place on this pool cache while doing the local invalidation. |
| |
*/ |
| |
void |
| |
pool_cache_invalidate_local(pool_cache_t pc) |
| |
{ |
| |
pool_cache_invalidate_cpu(pc, curcpu()->ci_index); |
| |
} |
| |
|
| |
/* |
| |
* pool_cache_invalidate_cpu: |
| |
* |
| |
* Invalidate all CPU-bound cached objects in pool cache, the CPU being |
| |
* identified by its associated index. |
| |
* It is caller's responsibility to ensure that no operation is |
| |
* taking place on this pool cache while doing this invalidation. |
| |
* WARNING: as no inter-CPU locking is enforced, trying to invalidate |
| |
* pool cached objects from a CPU different from the one currently running |
| |
* may result in an undefined behaviour. |
| |
*/ |
| |
static void |
| |
pool_cache_invalidate_cpu(pool_cache_t pc, u_int index) |
| |
{ |
| |
|
| |
pool_cache_cpu_t *cc; |
| |
pcg_t *pcg; |
| |
|
| |
if ((cc = pc->pc_cpus[index]) == NULL) |
| |
return; |
| |
|
| |
if ((pcg = cc->cc_current) != &pcg_dummy) { |
| |
pcg->pcg_next = NULL; |
| |
pool_cache_invalidate_groups(pc, pcg); |
| |
} |
| |
if ((pcg = cc->cc_previous) != &pcg_dummy) { |
| |
pcg->pcg_next = NULL; |
| |
pool_cache_invalidate_groups(pc, pcg); |
| |
} |
| |
if (cc != &pc->pc_cpu0) |
| |
pool_put(&cache_cpu_pool, cc); |
| |
|
| |
} |
| |
|
| void |
void |
| pool_cache_set_drain_hook(pool_cache_t pc, void (*fn)(void *, int), void *arg) |
pool_cache_set_drain_hook(pool_cache_t pc, void (*fn)(void *, int), void *arg) |
| { |
{ |