Changeset View
Changeset View
Standalone View
Standalone View
sys/kern/subr_pcpu.c
Show First 20 Lines • Show All 112 Lines • ▼ Show 20 Lines | dpcpu_init(void *dpcpu, int cpuid) | ||||
/* | /* | ||||
* Place it in the global pcpu offset array. | * Place it in the global pcpu offset array. | ||||
*/ | */ | ||||
dpcpu_off[cpuid] = pcpu->pc_dynamic; | dpcpu_off[cpuid] = pcpu->pc_dynamic; | ||||
} | } | ||||
static void | static void | ||||
dpcpu_startup(void *dummy __unused) | dpcpu_startup(void) | ||||
{ | { | ||||
struct dpcpu_free *df; | struct dpcpu_free *df; | ||||
df = malloc(sizeof(*df), M_PCPU, M_WAITOK | M_ZERO); | df = malloc(sizeof(*df), M_PCPU, M_WAITOK | M_ZERO); | ||||
df->df_start = (uintptr_t)&DPCPU_NAME(modspace); | df->df_start = (uintptr_t)&DPCPU_NAME(modspace); | ||||
df->df_len = DPCPU_MODMIN; | df->df_len = DPCPU_MODMIN; | ||||
TAILQ_INSERT_HEAD(&dpcpu_head, df, df_link); | TAILQ_INSERT_HEAD(&dpcpu_head, df, df_link); | ||||
sx_init(&dpcpu_lock, "dpcpu alloc lock"); | sx_init(&dpcpu_lock, "dpcpu alloc lock"); | ||||
} | } | ||||
SYSINIT(dpcpu, SI_SUB_KLD, SI_ORDER_FIRST, dpcpu_startup, NULL); | SYSINIT(dpcpu, SI_SUB_KLD, SI_ORDER_FIRST, dpcpu_startup); | ||||
/* | /* | ||||
* UMA_ZONE_PCPU zones for general kernel use. | * UMA_ZONE_PCPU zones for general kernel use. | ||||
*/ | */ | ||||
uma_zone_t pcpu_zone_4; | uma_zone_t pcpu_zone_4; | ||||
uma_zone_t pcpu_zone_8; | uma_zone_t pcpu_zone_8; | ||||
uma_zone_t pcpu_zone_16; | uma_zone_t pcpu_zone_16; | ||||
uma_zone_t pcpu_zone_32; | uma_zone_t pcpu_zone_32; | ||||
Show All 9 Lines | pcpu_zone_8 = uma_zcreate("pcpu-8", 8, | ||||
NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, UMA_ZONE_PCPU); | NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, UMA_ZONE_PCPU); | ||||
pcpu_zone_16 = uma_zcreate("pcpu-16", 16, | pcpu_zone_16 = uma_zcreate("pcpu-16", 16, | ||||
NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, UMA_ZONE_PCPU); | NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, UMA_ZONE_PCPU); | ||||
pcpu_zone_32 = uma_zcreate("pcpu-32", 32, | pcpu_zone_32 = uma_zcreate("pcpu-32", 32, | ||||
NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, UMA_ZONE_PCPU); | NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, UMA_ZONE_PCPU); | ||||
pcpu_zone_64 = uma_zcreate("pcpu-64", 64, | pcpu_zone_64 = uma_zcreate("pcpu-64", 64, | ||||
NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, UMA_ZONE_PCPU); | NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, UMA_ZONE_PCPU); | ||||
} | } | ||||
SYSINIT(pcpu_zones, SI_SUB_COUNTER, SI_ORDER_FIRST, pcpu_zones_startup, NULL); | SYSINIT(pcpu_zones, SI_SUB_COUNTER, SI_ORDER_FIRST, pcpu_zones_startup); | ||||
/* | /* | ||||
* First-fit extent based allocator for allocating space in the per-cpu | * First-fit extent based allocator for allocating space in the per-cpu | ||||
* region reserved for modules. This is only intended for use by the | * region reserved for modules. This is only intended for use by the | ||||
* kernel linkers to place module linker sets. | * kernel linkers to place module linker sets. | ||||
*/ | */ | ||||
void * | void * | ||||
dpcpu_alloc(int size) | dpcpu_alloc(int size) | ||||
▲ Show 20 Lines • Show All 260 Lines • Show Last 20 Lines |