Changeset View
Changeset View
Standalone View
Standalone View
head/sys/vm/uma_core.c
Show First 20 Lines • Show All 1,180 Lines • ▼ Show 20 Lines | pcpu_page_alloc(uma_zone_t zone, vm_size_t bytes, int domain, uint8_t *pflag, | ||||
struct pglist alloctail; | struct pglist alloctail; | ||||
vm_offset_t addr, zkva; | vm_offset_t addr, zkva; | ||||
int cpu, flags; | int cpu, flags; | ||||
vm_page_t p, p_next; | vm_page_t p, p_next; | ||||
#ifdef NUMA | #ifdef NUMA | ||||
struct pcpu *pc; | struct pcpu *pc; | ||||
#endif | #endif | ||||
TAILQ_INIT(&alloctail); | |||||
MPASS(bytes == (mp_maxid+1)*PAGE_SIZE); | MPASS(bytes == (mp_maxid + 1) * PAGE_SIZE); | ||||
*pflag = UMA_SLAB_KERNEL; | |||||
TAILQ_INIT(&alloctail); | |||||
flags = VM_ALLOC_SYSTEM | VM_ALLOC_WIRED | VM_ALLOC_NOOBJ | | flags = VM_ALLOC_SYSTEM | VM_ALLOC_WIRED | VM_ALLOC_NOOBJ | | ||||
((wait & M_WAITOK) != 0 ? VM_ALLOC_WAITOK : | malloc2vm_flags(wait); | ||||
VM_ALLOC_NOWAIT); | *pflag = UMA_SLAB_KERNEL; | ||||
for (cpu = 0; cpu <= mp_maxid; cpu++) { | for (cpu = 0; cpu <= mp_maxid; cpu++) { | ||||
if (CPU_ABSENT(cpu)) { | if (CPU_ABSENT(cpu)) { | ||||
p = vm_page_alloc(NULL, 0, flags); | p = vm_page_alloc(NULL, 0, flags); | ||||
} else { | } else { | ||||
#ifndef NUMA | #ifndef NUMA | ||||
p = vm_page_alloc(NULL, 0, flags); | p = vm_page_alloc(NULL, 0, flags); | ||||
#else | #else | ||||
pc = pcpu_find(cpu); | pc = pcpu_find(cpu); | ||||
▲ Show 20 Lines • Show All 1,119 Lines • ▼ Show 20 Lines | |||||
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; | ||||
#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 && (flags & M_ZERO)) { | ||||
#ifdef SMP | #ifdef SMP | ||||
CPU_FOREACH(i) | for (i = 0; i <= mp_maxid; i++) | ||||
bzero(zpcpu_get_cpu(item, i), zone->uz_size); | bzero(zpcpu_get_cpu(item, i), zone->uz_size); | ||||
#else | #else | ||||
bzero(item, zone->uz_size); | bzero(item, zone->uz_size); | ||||
#endif | #endif | ||||
} | } | ||||
return (item); | return (item); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 1,912 Lines • Show Last 20 Lines |