summaryrefslogtreecommitdiff
path: root/sys/kern
diff options
context:
space:
mode:
authorTed Unangst <tedu@cvs.openbsd.org>2013-05-31 20:44:11 +0000
committerTed Unangst <tedu@cvs.openbsd.org>2013-05-31 20:44:11 +0000
commitcb993534d12b98cd1ba9d48fa00de63bfb6ffc7e (patch)
treeff0192fb32e4b7691a8f203e80889971321bbb27 /sys/kern
parent69caec3e4da547fb4c899c8d28c7709a047affc3 (diff)
open up some races. if pool_debug == 2, force a yield() whenever waitok.
ok miod
Diffstat (limited to 'sys/kern')
-rw-r--r--sys/kern/kern_malloc.c10
-rw-r--r--sys/kern/subr_pool.c7
2 files changed, 13 insertions, 4 deletions
diff --git a/sys/kern/kern_malloc.c b/sys/kern/kern_malloc.c
index e72e675729d..74a4aab6b9f 100644
--- a/sys/kern/kern_malloc.c
+++ b/sys/kern/kern_malloc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kern_malloc.c,v 1.100 2013/05/03 18:26:07 tedu Exp $ */
+/* $OpenBSD: kern_malloc.c,v 1.101 2013/05/31 20:44:10 tedu Exp $ */
/* $NetBSD: kern_malloc.c,v 1.15.4.2 1996/06/13 17:10:56 cgd Exp $ */
/*
@@ -180,8 +180,14 @@ malloc(unsigned long size, int type, int flags)
KASSERT(flags & (M_WAITOK | M_NOWAIT));
- if ((flags & M_NOWAIT) == 0)
+#ifdef DIAGNOSTIC
+ if ((flags & M_NOWAIT) == 0) {
+ extern int pool_debug;
assertwaitok();
+ if (pool_debug == 2)
+ yield();
+ }
+#endif
#ifdef MALLOC_DEBUG
if (debug_malloc(size, type, flags, (void **)&va)) {
diff --git a/sys/kern/subr_pool.c b/sys/kern/subr_pool.c
index 0a8bbb95368..ddaab3988d5 100644
--- a/sys/kern/subr_pool.c
+++ b/sys/kern/subr_pool.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: subr_pool.c,v 1.120 2013/05/03 18:26:07 tedu Exp $ */
+/* $OpenBSD: subr_pool.c,v 1.121 2013/05/31 20:44:10 tedu Exp $ */
/* $NetBSD: subr_pool.c,v 1.61 2001/09/26 07:14:56 chs Exp $ */
/*-
@@ -484,8 +484,11 @@ pool_get(struct pool *pp, int flags)
KASSERT(flags & (PR_WAITOK | PR_NOWAIT));
#ifdef DIAGNOSTIC
- if ((flags & PR_WAITOK) != 0)
+ if ((flags & PR_WAITOK) != 0) {
assertwaitok();
+ if (pool_debug == 2)
+ yield();
+ }
#endif /* DIAGNOSTIC */
mtx_enter(&pp->pr_mtx);