From 4c1cc01cd834034963247faeea45682458da9924 Mon Sep 17 00:00:00 2001 From: John Baldwin Date: Mon, 20 May 2002 17:54:48 +0000 Subject: [PATCH] In uma_zalloc_arg(), if we are performing a M_WAITOK allocation, ensure that td_intr_nesting_level is 0 (like malloc() does). Since malloc() calls uma we can probably remove the check in malloc() for this now. Also, perform an extra witness check in that case to make sure we don't hold any locks when performing a M_WAITOK allocation. --- sys/vm/uma_core.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/sys/vm/uma_core.c b/sys/vm/uma_core.c index df7966828980..c6924b0b7080 100644 --- a/sys/vm/uma_core.c +++ b/sys/vm/uma_core.c @@ -66,6 +66,7 @@ #include #include #include +#include #include #include @@ -1317,6 +1318,12 @@ uma_zalloc_arg(uma_zone_t zone, void *udata, int flags) printf("Allocating one item from %s(%p)\n", zone->uz_name, zone); #endif + if (!(flags & M_NOWAIT)) { + KASSERT(curthread->td_intr_nesting_level == 0, + ("malloc(M_WAITOK) in interrupt context")); + WITNESS_SLEEP(1, NULL); + } + zalloc_restart: cpu = PCPU_GET(cpuid); CPU_LOCK(zone, cpu);