From d6f9a991c6690168c2012037cb4e71840917f2a6 Mon Sep 17 00:00:00 2001 From: rwatson Date: Wed, 10 Jan 2007 21:04:43 +0000 Subject: [PATCH] Remove uma_zalloc_arg() hack, which coerced M_WAITOK to M_NOWAIT when allocations were made using improper flags in interrupt context. Replace with a simple WITNESS warning call. This restores the invariant that M_WAITOK allocations will always succeed or die horribly trying, which is relied on by many UMA consumers. MFC after: 3 weeks Discussed with: jhb --- sys/vm/uma_core.c | 25 +++---------------------- 1 file changed, 3 insertions(+), 22 deletions(-) diff --git a/sys/vm/uma_core.c b/sys/vm/uma_core.c index ac3ffc425d6a..0bdcd2fbc8fe 100644 --- a/sys/vm/uma_core.c +++ b/sys/vm/uma_core.c @@ -1772,7 +1772,6 @@ uma_zalloc_arg(uma_zone_t zone, void *udata, int flags) uma_cache_t cache; uma_bucket_t bucket; int cpu; - int badness; /* This is the fast path allocation */ #ifdef UMA_DEBUG_ALLOC_1 @@ -1781,27 +1780,9 @@ uma_zalloc_arg(uma_zone_t zone, void *udata, int flags) CTR3(KTR_UMA, "uma_zalloc_arg thread %x zone %s flags %d", curthread, zone->uz_name, flags); - if (!(flags & M_NOWAIT)) { - KASSERT(curthread->td_intr_nesting_level == 0, - ("malloc(M_WAITOK) in interrupt context")); - if (nosleepwithlocks) { -#ifdef WITNESS - badness = WITNESS_CHECK(WARN_GIANTOK | WARN_SLEEPOK, - NULL, - "malloc(M_WAITOK) of \"%s\", forcing M_NOWAIT", - zone->uz_name); -#else - badness = 1; -#endif - } else { - badness = 0; - WITNESS_WARN(WARN_GIANTOK | WARN_SLEEPOK, NULL, - "malloc(M_WAITOK) of \"%s\"", zone->uz_name); - } - if (badness) { - flags &= ~M_WAITOK; - flags |= M_NOWAIT; - } + if (flags & M_WAITOK) { + WITNESS_WARN(WARN_GIANTOK | WARN_SLEEPOK, NULL, + "uma_zalloc_arg: zone \"%s\"", zone->uz_name); } /*