diff options
author | green <green@FreeBSD.org> | 2004-07-04 15:59:25 +0000 |
---|---|---|
committer | green <green@FreeBSD.org> | 2004-07-04 15:59:25 +0000 |
commit | 77ef401fc60964c4edacb0a34bd820a3d426491d (patch) | |
tree | 4d4bb84b825ce1e3098b1eb1a3d155bc835463d6 /sys/vm | |
parent | b6bb334af424373538c48137c60a03a2a221ac4d (diff) | |
download | FreeBSD-src-77ef401fc60964c4edacb0a34bd820a3d426491d.zip FreeBSD-src-77ef401fc60964c4edacb0a34bd820a3d426491d.tar.gz |
Reextend the M_WAITOK-disabling-hack to all three of the mbuf-related
zones, and do it by direct comparison of uma_zone_t instead of strcmp.
The mbuf subsystem used to provide M_TRYWAIT/M_DONTWAIT semantics, but
this is mostly no longer the case. M_WAITOK has taken over the spot
M_TRYWAIT used to have, and for mbuf things, still may return NULL if
the code path is incorrectly holding a mutex going into mbuf allocation
functions.
The M_WAITOK/M_NOWAIT semantics are absolute; though it may deadlock
the system to try to malloc or uma_zalloc something with a mutex held
and M_WAITOK specified, it is absolutely required to not return NULL
and will result in instability and/or security breaches otherwise.
There is still room to add the WITNESS_WARN() to all cases so that
we are notified of the possibility of deadlocks, but it cannot change
the value of the "badness" variable and allow allocation to actually
fail except for the specialized cases which used to be M_TRYWAIT.
Diffstat (limited to 'sys/vm')
-rw-r--r-- | sys/vm/uma_core.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/sys/vm/uma_core.c b/sys/vm/uma_core.c index 1012df5..9e1f7d4 100644 --- a/sys/vm/uma_core.c +++ b/sys/vm/uma_core.c @@ -68,7 +68,7 @@ __FBSDID("$FreeBSD$"); #include <sys/proc.h> #include <sys/smp.h> #include <sys/vmmeter.h> -#include <sys/mbuf.h> +#include <sys/mbuf.h> /* XXX WITNESS_WARN() hack */ #include <vm/vm.h> #include <vm/vm_object.h> @@ -1613,7 +1613,9 @@ uma_zalloc_arg(uma_zone_t zone, void *udata, int flags) if (!(flags & M_NOWAIT)) { KASSERT(curthread->td_intr_nesting_level == 0, ("malloc(M_WAITOK) in interrupt context")); - if (strcmp(zone->uz_name, "Mbuf") == 0) + if ((zone_mbuf != NULL && zone == zone_mbuf) || + (zone_clust != NULL && zone == zone_clust) || + (zone_pack != NULL && zone == zone_pack)) #ifdef WITNESS badness = WITNESS_WARN(WARN_GIANTOK | WARN_SLEEPOK, NULL, |