aboutsummaryrefslogtreecommitdiff
path: root/sys/kern/kern_malloc.c
diff options
context:
space:
mode:
authorPoul-Henning Kamp <phk@FreeBSD.org>1999-09-19 08:40:11 +0000
committerPoul-Henning Kamp <phk@FreeBSD.org>1999-09-19 08:40:11 +0000
commit984982d6aeaf276d249d8d43498396f021637917 (patch)
tree16e3f76f40d4becdb176fc795088fd2b8dd59aa2 /sys/kern/kern_malloc.c
parent7248ef86e04b58fce394f84825407c0f69b335ab (diff)
downloadsrc-984982d6aeaf276d249d8d43498396f021637917.tar.gz
src-984982d6aeaf276d249d8d43498396f021637917.zip
KASSERT that we cannot use M_WAITOK in interrupt context.
Reviewed by: bde
Notes
Notes: svn path=/head/; revision=51401
Diffstat (limited to 'sys/kern/kern_malloc.c')
-rw-r--r--sys/kern/kern_malloc.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/sys/kern/kern_malloc.c b/sys/kern/kern_malloc.c
index 56cff7f204c8..b660aaab090a 100644
--- a/sys/kern/kern_malloc.c
+++ b/sys/kern/kern_malloc.c
@@ -51,6 +51,10 @@
#include <vm/pmap.h>
#include <vm/vm_map.h>
+#if defined(INVARIANTS) && defined(__i386__)
+#include <machine/cpu.h>
+#endif
+
MALLOC_DEFINE(M_CACHE, "namecache", "Dynamically allocated cache entries");
MALLOC_DEFINE(M_DEVBUF, "devbuf", "device driver memory");
MALLOC_DEFINE(M_TEMP, "temp", "misc temporary data buffers");
@@ -134,6 +138,11 @@ malloc(size, type, flags)
#endif
register struct malloc_type *ksp = type;
+#if defined(INVARIANTS) && defined(__i386__)
+ if (flags == M_WAITOK)
+ KASSERT(intr_nesting_level == 0,
+ ("malloc(M_WAITOK) in interrupt context"));
+#endif
/*
* Must be at splmem() prior to initializing segment to handle
* potential initialization race.