Changeset View
Changeset View
Standalone View
Standalone View
sys/vm/uma_core.c
Show First 20 Lines • Show All 2,100 Lines • ▼ Show 20 Lines | uma_zalloc_arg(uma_zone_t zone, void *udata, int flags) | ||||
/* This is the fast path allocation */ | /* This is the fast path allocation */ | ||||
#ifdef UMA_DEBUG_ALLOC_1 | #ifdef UMA_DEBUG_ALLOC_1 | ||||
printf("Allocating one item from %s(%p)\n", zone->uz_name, zone); | printf("Allocating one item from %s(%p)\n", zone->uz_name, zone); | ||||
#endif | #endif | ||||
CTR3(KTR_UMA, "uma_zalloc_arg thread %x zone %s flags %d", curthread, | CTR3(KTR_UMA, "uma_zalloc_arg thread %x zone %s flags %d", curthread, | ||||
zone->uz_name, flags); | zone->uz_name, flags); | ||||
KASSERT(curthread->td_intr_nesting_level == 0, | |||||
("uma_zalloc_arg in interrupt context")); | |||||
if (flags & M_WAITOK) { | if (flags & M_WAITOK) { | ||||
WITNESS_WARN(WARN_GIANTOK | WARN_SLEEPOK, NULL, | WITNESS_WARN(WARN_GIANTOK | WARN_SLEEPOK, NULL, | ||||
"uma_zalloc_arg: zone \"%s\"", zone->uz_name); | "uma_zalloc_arg: zone \"%s\"", zone->uz_name); | ||||
KASSERT_WARN(THREAD_CAN_SLEEP(), | |||||
("uma_zalloc_arg(M_WAITOK) in no_sleeping context")); | |||||
} | } | ||||
#ifdef DEBUG_MEMGUARD | #ifdef DEBUG_MEMGUARD | ||||
if (memguard_cmp_zone(zone)) { | if (memguard_cmp_zone(zone)) { | ||||
item = memguard_alloc(zone->uz_size, flags); | item = memguard_alloc(zone->uz_size, flags); | ||||
if (item != NULL) { | if (item != NULL) { | ||||
/* | /* | ||||
* Avoid conflict with the use-after-free | * Avoid conflict with the use-after-free | ||||
* protecting infrastructure from INVARIANTS. | * protecting infrastructure from INVARIANTS. | ||||
▲ Show 20 Lines • Show All 1,446 Lines • Show Last 20 Lines |