Index: sys/kern/kern_malloc.c =================================================================== --- sys/kern/kern_malloc.c +++ sys/kern/kern_malloc.c @@ -618,6 +618,9 @@ unsigned long osize = size; #endif + KASSERT((flags & M_WAITOK) == 0 || THREAD_CAN_SLEEP(), + ("malloc(M_WAITOK) in non-sleepable context")); + #ifdef MALLOC_DEBUG va = NULL; if (malloc_dbg(&va, &size, mtp, flags) != 0) Index: sys/vm/uma_core.c =================================================================== --- sys/vm/uma_core.c +++ sys/vm/uma_core.c @@ -3328,6 +3328,9 @@ uma_cache_bucket_t bucket; uma_cache_t cache; + KASSERT((flags & M_WAITOK) == 0 || THREAD_CAN_SLEEP(), + ("uma_zalloc_smr(M_WAITOK) in non-sleepable context")); + #ifdef UMA_ZALLOC_DEBUG void *item; @@ -3351,6 +3354,9 @@ { uma_cache_bucket_t bucket; uma_cache_t cache; + + KASSERT((flags & M_WAITOK) == 0 || THREAD_CAN_SLEEP(), + ("uma_zalloc(M_WAITOK) in non-sleepable context")); /* Enable entropy collection for RANDOM_ENABLE_UMA kernel option */ random_harvest_fast_uma(&zone, sizeof(zone), RANDOM_UMA);