Changeset View
Changeset View
Standalone View
Standalone View
sys/vm/uma_core.c
Show First 20 Lines • Show All 2,943 Lines • ▼ Show 20 Lines | uma_zwait(uma_zone_t zone) | ||||
item = uma_zalloc_arg(zone, NULL, M_WAITOK); | item = uma_zalloc_arg(zone, NULL, M_WAITOK); | ||||
uma_zfree(zone, item); | uma_zfree(zone, item); | ||||
} | } | ||||
void * | void * | ||||
uma_zalloc_pcpu_arg(uma_zone_t zone, void *udata, int flags) | uma_zalloc_pcpu_arg(uma_zone_t zone, void *udata, int flags) | ||||
{ | { | ||||
void *item; | void *item, *pcpu_item; | ||||
#ifdef SMP | #ifdef SMP | ||||
int i; | int i; | ||||
MPASS(zone->uz_flags & UMA_ZONE_PCPU); | MPASS(zone->uz_flags & UMA_ZONE_PCPU); | ||||
#endif | #endif | ||||
item = uma_zalloc_arg(zone, udata, flags & ~M_ZERO); | item = uma_zalloc_arg(zone, udata, flags & ~M_ZERO); | ||||
if (item != NULL && (flags & M_ZERO)) { | if (item == NULL) | ||||
return (NULL); | |||||
pcpu_item = zpcpu_real_to_pcpu(item); | |||||
jeff: It is cleaner to do this part in uz_import/uz_export. This way it's done once when they're… | |||||
mjgAuthorUnsubmitted Done Inline ActionsI think that would be highly iffy. Note that right now the per-cpu stuff just wraps the standard uma_zalloc. To kib's debug-ability point, I think it's much saner to keep "real" addresses with confines of uma. mjg: I think that would be highly iffy. Note that right now the per-cpu stuff just wraps the… | |||||
jeffUnsubmitted Not Done Inline ActionsUMA's zone layer just deals with opaque pointers. It doesn't touch the memory. It would already be broken if it touched pcpu memory. jeff: UMA's zone layer just deals with opaque pointers. It doesn't touch the memory. It would… | |||||
if (flags & M_ZERO) { | |||||
#ifdef SMP | #ifdef SMP | ||||
for (i = 0; i <= mp_maxid; i++) | for (i = 0; i <= mp_maxid; i++) | ||||
bzero(zpcpu_get_cpu(item, i), zone->uz_size); | bzero(zpcpu_get_cpu(pcpu_item, i), zone->uz_size); | ||||
#else | #else | ||||
bzero(item, zone->uz_size); | bzero(item, zone->uz_size); | ||||
#endif | #endif | ||||
} | } | ||||
return (item); | return (pcpu_item); | ||||
} | } | ||||
/* | /* | ||||
* A stub while both regular and pcpu cases are identical. | * A stub while both regular and pcpu cases are identical. | ||||
*/ | */ | ||||
void | void | ||||
uma_zfree_pcpu_arg(uma_zone_t zone, void *item, void *udata) | uma_zfree_pcpu_arg(uma_zone_t zone, void *pcpu_item, void *udata) | ||||
{ | { | ||||
void *item; | |||||
#ifdef SMP | #ifdef SMP | ||||
MPASS(zone->uz_flags & UMA_ZONE_PCPU); | MPASS(zone->uz_flags & UMA_ZONE_PCPU); | ||||
#endif | #endif | ||||
item = zpcpu_pcpu_to_real(pcpu_item); | |||||
uma_zfree_arg(zone, item, udata); | uma_zfree_arg(zone, item, udata); | ||||
} | } | ||||
static inline void * | static inline void * | ||||
item_ctor(uma_zone_t zone, int uz_flags, int size, void *udata, int flags, | item_ctor(uma_zone_t zone, int uz_flags, int size, void *udata, int flags, | ||||
void *item) | void *item) | ||||
{ | { | ||||
#ifdef INVARIANTS | #ifdef INVARIANTS | ||||
▲ Show 20 Lines • Show All 2,335 Lines • Show Last 20 Lines |
It is cleaner to do this part in uz_import/uz_export. This way it's done once when they're placed in the bucket, not for every caller.