diff options
author | Ted Unangst <tedu@cvs.openbsd.org> | 2007-05-28 17:55:57 +0000 |
---|---|---|
committer | Ted Unangst <tedu@cvs.openbsd.org> | 2007-05-28 17:55:57 +0000 |
commit | 864d75d1b5d0f64002c0b9c5e0272f2e8f8bd4e9 (patch) | |
tree | 33009ec9ebf1c8559a062d3067c53ba96ad316da /sys/kern | |
parent | 633fb61fd27769e345a2323a1a7c27b72eabbd60 (diff) |
add a pool_setipl function, which allows setting an appropriate ipl
for splassert inside pool_get and pool_put (DIAGNOSTIC only)
ok miod pedro thib
Diffstat (limited to 'sys/kern')
-rw-r--r-- | sys/kern/subr_pool.c | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/sys/kern/subr_pool.c b/sys/kern/subr_pool.c index 1e21bd95e6a..6bb9ff9b12f 100644 --- a/sys/kern/subr_pool.c +++ b/sys/kern/subr_pool.c @@ -1,4 +1,4 @@ -/* $OpenBSD: subr_pool.c,v 1.51 2007/04/23 09:27:59 art Exp $ */ +/* $OpenBSD: subr_pool.c,v 1.52 2007/05/28 17:55:56 tedu Exp $ */ /* $NetBSD: subr_pool.c,v 1.61 2001/09/26 07:14:56 chs Exp $ */ /*- @@ -517,6 +517,8 @@ pool_init(struct pool *pp, size_t size, u_int align, u_int ioff, int flags, simple_lock_init(&pp->pr_slock); + pp->pr_ipl = -1; + /* * Initialize private page header pool and cache magazine pool if we * haven't done so yet. @@ -542,6 +544,14 @@ pool_init(struct pool *pp, size_t size, u_int align, u_int ioff, int flags, simple_unlock(&palloc->pa_slock); } +#ifdef DIAGNOSTIC +void +pool_setipl(struct pool *pp, int ipl) +{ + pp->pr_ipl = ipl; +} +#endif + /* * Decommission a pool resource. */ @@ -621,6 +631,8 @@ pool_get(struct pool *pp, int flags) #ifdef DIAGNOSTIC if ((flags & PR_WAITOK) != 0) splassert(IPL_NONE); + if (pp->pr_ipl != -1) + splassert(pp->pr_ipl); if (__predict_false(curproc == NULL && /* doing_shutdown == 0 && XXX*/ (flags & PR_WAITOK) != 0)) panic("pool_get: %s:must have NOWAIT", pp->pr_wchan); @@ -864,6 +876,9 @@ pool_do_put(struct pool *pp, void *v) page = (caddr_t)((vaddr_t)v & pp->pr_alloc->pa_pagemask); #ifdef DIAGNOSTIC + if (pp->pr_ipl != -1) + splassert(pp->pr_ipl); + if (__predict_false(pp->pr_nout == 0)) { printf("pool %s: putting with none out\n", pp->pr_wchan); |