| version 1.128.2.12, 2007/10/29 16:37:44 |
version 1.128.2.13, 2007/11/01 21:10:14 |
| Line 1572 pool_reclaim(struct pool *pp) |
|
| Line 1572 pool_reclaim(struct pool *pp) |
|
| struct pool_item_header *ph, *phnext; |
struct pool_item_header *ph, *phnext; |
| struct pool_pagelist pq; |
struct pool_pagelist pq; |
| struct timeval curtime, diff; |
struct timeval curtime, diff; |
| |
bool klock; |
| |
int rv; |
| |
|
| if (pp->pr_drain_hook != NULL) { |
if (pp->pr_drain_hook != NULL) { |
| /* |
/* |
| Line 1580 pool_reclaim(struct pool *pp) |
|
| Line 1582 pool_reclaim(struct pool *pp) |
|
| (*pp->pr_drain_hook)(pp->pr_drain_hook_arg, PR_NOWAIT); |
(*pp->pr_drain_hook)(pp->pr_drain_hook_arg, PR_NOWAIT); |
| } |
} |
| |
|
| |
/* |
| |
* XXXSMP Because mutexes at IPL_SOFTXXX are still spinlocks, |
| |
* and we are called from the pagedaemon without kernel_lock. |
| |
* Does not apply to IPL_SOFTBIO. |
| |
*/ |
| |
switch (pp->pr_ipl) { |
| |
case IPL_SOFTNET: |
| |
case IPL_SOFTCLOCK: |
| |
case IPL_SOFTSERIAL: |
| |
KERNEL_LOCK(1, NULL); |
| |
klock = true; |
| |
break; |
| |
default: |
| |
klock = false; |
| |
break; |
| |
} |
| |
|
| /* Reclaim items from the pool's cache (if any). */ |
/* Reclaim items from the pool's cache (if any). */ |
| if (pp->pr_cache != NULL) |
if (pp->pr_cache != NULL) |
| pool_cache_invalidate(pp->pr_cache); |
pool_cache_invalidate(pp->pr_cache); |
| |
|
| if (mutex_tryenter(&pp->pr_lock) == 0) |
if (mutex_tryenter(&pp->pr_lock) == 0) { |
| |
if (klock) { |
| |
KERNEL_UNLOCK_ONE(NULL); |
| |
} |
| return (0); |
return (0); |
| |
} |
| pr_enter(pp, file, line); |
pr_enter(pp, file, line); |
| |
|
| LIST_INIT(&pq); |
LIST_INIT(&pq); |
| Line 1618 pool_reclaim(struct pool *pp) |
|
| Line 1641 pool_reclaim(struct pool *pp) |
|
| |
|
| pr_leave(pp); |
pr_leave(pp); |
| mutex_exit(&pp->pr_lock); |
mutex_exit(&pp->pr_lock); |
| |
|
| if (LIST_EMPTY(&pq)) |
if (LIST_EMPTY(&pq)) |
| return 0; |
rv = 0; |
| |
else { |
| |
pr_pagelist_free(pp, &pq); |
| |
rv = 1; |
| |
} |
| |
|
| pr_pagelist_free(pp, &pq); |
if (klock) { |
| |
KERNEL_UNLOCK_ONE(NULL); |
| |
} |
| |
|
| return (1); |
return (rv); |
| } |
} |
| |
|
| /* |
/* |
| Line 2631 pool_cache_xcall(pool_cache_t pc) |
|
| Line 2661 pool_cache_xcall(pool_cache_t pc) |
|
| cc->cc_previous = NULL; |
cc->cc_previous = NULL; |
| pool_cache_cpu_exit(cc, &s); |
pool_cache_cpu_exit(cc, &s); |
| |
|
| |
/* |
| |
* XXXSMP Go to splvm to prevent kernel_lock from being taken, |
| |
* because locks at IPL_SOFTXXX are still spinlocks. Does not |
| |
* apply to IPL_SOFTBIO. Cross-call threads do not take the |
| |
* kernel_lock. |
| |
*/ |
| |
s = splvm(); |
| mutex_enter(&pc->pc_lock); |
mutex_enter(&pc->pc_lock); |
| if (cur != NULL) { |
if (cur != NULL) { |
| if (cur->pcg_avail == PCG_NOBJECTS) { |
if (cur->pcg_avail == PCG_NOBJECTS) { |
| Line 2661 pool_cache_xcall(pool_cache_t pc) |
|
| Line 2698 pool_cache_xcall(pool_cache_t pc) |
|
| *list = prev; |
*list = prev; |
| } |
} |
| mutex_exit(&pc->pc_lock); |
mutex_exit(&pc->pc_lock); |
| |
splx(s); |
| } |
} |
| |
|
| /* |
/* |