Changeset View
Changeset View
Standalone View
Standalone View
sys/vm/uma_core.c
Show First 20 Lines • Show All 2,143 Lines • ▼ Show 20 Lines | |||||
#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); | ||||
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(curthread->td_critnest == 0, | |||||
("uma_zalloc_arg: called with spinlock or critical section held")); | |||||
#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 520 Lines • ▼ Show 20 Lines | uma_zfree_arg(uma_zone_t zone, void *item, void *udata) | ||||
/* Enable entropy collection for RANDOM_ENABLE_UMA kernel option */ | /* Enable entropy collection for RANDOM_ENABLE_UMA kernel option */ | ||||
random_harvest_fast_uma(&zone, sizeof(zone), 1, RANDOM_UMA); | random_harvest_fast_uma(&zone, sizeof(zone), 1, RANDOM_UMA); | ||||
#ifdef UMA_DEBUG_ALLOC_1 | #ifdef UMA_DEBUG_ALLOC_1 | ||||
printf("Freeing item %p to %s(%p)\n", item, zone->uz_name, zone); | printf("Freeing item %p to %s(%p)\n", item, zone->uz_name, zone); | ||||
#endif | #endif | ||||
CTR2(KTR_UMA, "uma_zfree_arg thread %x zone %s", curthread, | CTR2(KTR_UMA, "uma_zfree_arg thread %x zone %s", curthread, | ||||
zone->uz_name); | zone->uz_name); | ||||
KASSERT(curthread->td_critnest == 0, | |||||
("uma_zfree_arg: called with spinlock or critical section held")); | |||||
/* uma_zfree(..., NULL) does nothing, to match free(9). */ | /* uma_zfree(..., NULL) does nothing, to match free(9). */ | ||||
if (item == NULL) | if (item == NULL) | ||||
return; | return; | ||||
#ifdef DEBUG_MEMGUARD | #ifdef DEBUG_MEMGUARD | ||||
if (is_memguard_addr(item)) { | if (is_memguard_addr(item)) { | ||||
if (zone->uz_dtor != NULL && zone->uz_dtor != mtrash_dtor) | if (zone->uz_dtor != NULL && zone->uz_dtor != mtrash_dtor) | ||||
zone->uz_dtor(item, zone->uz_size, udata); | zone->uz_dtor(item, zone->uz_size, udata); | ||||
▲ Show 20 Lines • Show All 946 Lines • Show Last 20 Lines |