summaryrefslogtreecommitdiffstats
path: root/sys/kern/kern_malloc.c
diff options
context:
space:
mode:
authorphk <phk@FreeBSD.org>1999-09-19 08:40:11 +0000
committerphk <phk@FreeBSD.org>1999-09-19 08:40:11 +0000
commit86867c69d2a9595e95cc41c77bf068ee4d223f8c (patch)
tree80bb85edf37fcb0ec30876d1b25fe53ce014e82f /sys/kern/kern_malloc.c
parentb364262c2eaf35eea8405454f53263cd494036f2 (diff)
downloadFreeBSD-src-86867c69d2a9595e95cc41c77bf068ee4d223f8c.zip
FreeBSD-src-86867c69d2a9595e95cc41c77bf068ee4d223f8c.tar.gz
KASSERT that we cannot use M_WAITOK in interrupt context.
Reviewed by: bde
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 56cff7f..b660aaa 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.
OpenPOWER on IntegriCloud