summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sys/kern/subr_pool.c17
-rw-r--r--sys/sys/pool.h8
2 files changed, 23 insertions, 2 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);
diff --git a/sys/sys/pool.h b/sys/sys/pool.h
index 46c55b65632..fe7130c478a 100644
--- a/sys/sys/pool.h
+++ b/sys/sys/pool.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: pool.h,v 1.23 2007/04/23 11:28:24 art Exp $ */
+/* $OpenBSD: pool.h,v 1.24 2007/05/28 17:55:56 tedu Exp $ */
/* $NetBSD: pool.h,v 1.27 2001/06/06 22:00:17 rafal Exp $ */
/*-
@@ -148,6 +148,7 @@ struct pool {
* since the page allocators may block.
*/
struct simplelock pr_slock;
+ int pr_ipl;
SPLAY_HEAD(phtree, pool_item_header) pr_phtree;
@@ -193,6 +194,11 @@ extern struct pool_allocator pool_allocator_nointr;
void pool_init(struct pool *, size_t, u_int, u_int, int,
const char *, struct pool_allocator *);
+#ifdef DIAGNOSTIC
+void pool_setipl(struct pool *, int);
+#else
+#define pool_setipl(p, i) do { /* nothing */ } while (0)
+#endif
void pool_destroy(struct pool *);
void *pool_get(struct pool *, int) __malloc;