| version 1.156, 2008/03/27 18:30:15 |
version 1.156.2.2, 2008/06/04 02:05:39 |
|
|
| /* $NetBSD$ */ |
/* $NetBSD$ */ |
| |
|
| /*- |
/*- |
| * Copyright (c) 1997, 1999, 2000, 2002, 2007 The NetBSD Foundation, Inc. |
* Copyright (c) 1997, 1999, 2000, 2002, 2007, 2008 The NetBSD Foundation, Inc. |
| * All rights reserved. |
* All rights reserved. |
| * |
* |
| * This code is derived from software contributed to The NetBSD Foundation |
* This code is derived from software contributed to The NetBSD Foundation |
|
|
| * 2. Redistributions in binary form must reproduce the above copyright |
* 2. Redistributions in binary form must reproduce the above copyright |
| * notice, this list of conditions and the following disclaimer in the |
* notice, this list of conditions and the following disclaimer in the |
| * documentation and/or other materials provided with the distribution. |
* documentation and/or other materials provided with the distribution. |
| * 3. All advertising materials mentioning features or use of this software |
|
| * must display the following acknowledgement: |
|
| * This product includes software developed by the NetBSD |
|
| * Foundation, Inc. and its contributors. |
|
| * 4. Neither the name of The NetBSD Foundation nor the names of its |
|
| * contributors may be used to endorse or promote products derived |
|
| * from this software without specific prior written permission. |
|
| * |
* |
| * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS |
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS |
| * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED |
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED |
| Line 814 pool_init(struct pool *pp, size_t size, |
|
| Line 807 pool_init(struct pool *pp, size_t size, |
|
| pp->pr_entered_file = NULL; |
pp->pr_entered_file = NULL; |
| pp->pr_entered_line = 0; |
pp->pr_entered_line = 0; |
| |
|
| /* |
mutex_init(&pp->pr_lock, MUTEX_DEFAULT, ipl); |
| * XXXAD hack to prevent IP input processing from blocking. |
|
| */ |
|
| if (ipl == IPL_SOFTNET) { |
|
| mutex_init(&pp->pr_lock, MUTEX_DEFAULT, IPL_VM); |
|
| } else { |
|
| mutex_init(&pp->pr_lock, MUTEX_DEFAULT, ipl); |
|
| } |
|
| cv_init(&pp->pr_cv, wchan); |
cv_init(&pp->pr_cv, wchan); |
| pp->pr_ipl = ipl; |
pp->pr_ipl = ipl; |
| |
|
| Line 1629 pool_reclaim(struct pool *pp) |
|
| Line 1615 pool_reclaim(struct pool *pp) |
|
| } |
} |
| |
|
| /* |
/* |
| * XXXSMP Because mutexes at IPL_SOFTXXX are still spinlocks, |
* XXXSMP Because we do not want to cause non-MPSAFE code |
| * and we are called from the pagedaemon without kernel_lock. |
* to block. |
| * Does not apply to IPL_SOFTBIO. |
|
| */ |
*/ |
| if (pp->pr_ipl == IPL_SOFTNET || pp->pr_ipl == IPL_SOFTCLOCK || |
if (pp->pr_ipl == IPL_SOFTNET || pp->pr_ipl == IPL_SOFTCLOCK || |
| pp->pr_ipl == IPL_SOFTSERIAL) { |
pp->pr_ipl == IPL_SOFTSERIAL) { |
| Line 2074 pool_cache_bootstrap(pool_cache_t pc, si |
|
| Line 2059 pool_cache_bootstrap(pool_cache_t pc, si |
|
| if (palloc == NULL && ipl == IPL_NONE) |
if (palloc == NULL && ipl == IPL_NONE) |
| palloc = &pool_allocator_nointr; |
palloc = &pool_allocator_nointr; |
| pool_init(pp, size, align, align_offset, flags, wchan, palloc, ipl); |
pool_init(pp, size, align, align_offset, flags, wchan, palloc, ipl); |
| |
mutex_init(&pc->pc_lock, MUTEX_DEFAULT, ipl); |
| /* |
|
| * XXXAD hack to prevent IP input processing from blocking. |
|
| */ |
|
| if (ipl == IPL_SOFTNET) { |
|
| mutex_init(&pc->pc_lock, MUTEX_DEFAULT, IPL_VM); |
|
| } else { |
|
| mutex_init(&pc->pc_lock, MUTEX_DEFAULT, ipl); |
|
| } |
|
| |
|
| if (ctor == NULL) { |
if (ctor == NULL) { |
| ctor = (int (*)(void *, void *, int))nullop; |
ctor = (int (*)(void *, void *, int))nullop; |
| Line 2392 pool_cache_cpu_enter(pool_cache_t pc, in |
|
| Line 2369 pool_cache_cpu_enter(pool_cache_t pc, in |
|
| * CPU-local data. To avoid touching shared state, we |
* CPU-local data. To avoid touching shared state, we |
| * pull the neccessary information from CPU local data. |
* pull the neccessary information from CPU local data. |
| */ |
*/ |
| crit_enter(); |
KPREEMPT_DISABLE(curlwp); |
| cc = pc->pc_cpus[curcpu()->ci_index]; |
cc = pc->pc_cpus[curcpu()->ci_index]; |
| KASSERT(cc->cc_cache == pc); |
KASSERT(cc->cc_cache == pc); |
| if (cc->cc_ipl != IPL_NONE) { |
if (cc->cc_ipl != IPL_NONE) { |
| Line 2410 pool_cache_cpu_exit(pool_cache_cpu_t *cc |
|
| Line 2387 pool_cache_cpu_exit(pool_cache_cpu_t *cc |
|
| if (cc->cc_ipl != IPL_NONE) { |
if (cc->cc_ipl != IPL_NONE) { |
| splx(*s); |
splx(*s); |
| } |
} |
| crit_exit(); |
KPREEMPT_ENABLE(curlwp); |
| } |
} |
| |
|
| #if __GNUC_PREREQ__(3, 0) |
pool_cache_cpu_t * __noinline |
| __attribute ((noinline)) |
|
| #endif |
|
| pool_cache_cpu_t * |
|
| pool_cache_get_slow(pool_cache_cpu_t *cc, int *s, void **objectp, |
pool_cache_get_slow(pool_cache_cpu_t *cc, int *s, void **objectp, |
| paddr_t *pap, int flags) |
paddr_t *pap, int flags) |
| { |
{ |
| Line 2567 pool_cache_get_paddr(pool_cache_t pc, in |
|
| Line 2541 pool_cache_get_paddr(pool_cache_t pc, in |
|
| return object; |
return object; |
| } |
} |
| |
|
| #if __GNUC_PREREQ__(3, 0) |
pool_cache_cpu_t * __noinline |
| __attribute ((noinline)) |
|
| #endif |
|
| pool_cache_cpu_t * |
|
| pool_cache_put_slow(pool_cache_cpu_t *cc, int *s, void *object, paddr_t pa) |
pool_cache_put_slow(pool_cache_cpu_t *cc, int *s, void *object, paddr_t pa) |
| { |
{ |
| pcg_t *pcg, *cur; |
pcg_t *pcg, *cur; |