MCPcopy Create free account
hub / github.com/F-Stack/f-stack / malloc_init

Function malloc_init

freebsd/kern/kern_malloc.c:1202–1224  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1200SYSINIT(kmem, SI_SUB_KMEM, SI_ORDER_SECOND, mallocinit, NULL);
1201
1202void
1203malloc_init(void *data)
1204{
1205 struct malloc_type_internal *mtip;
1206 struct malloc_type *mtp;
1207
1208 KASSERT(vm_cnt.v_page_count != 0, ("malloc_register before vm_init"));
1209
1210 mtp = data;
1211 if (mtp->ks_version != M_VERSION)
1212 panic("malloc_init: type %s with unsupported version %lu",
1213 mtp->ks_shortdesc, mtp->ks_version);
1214
1215 mtip = &mtp->ks_mti;
1216 mtip->mti_stats = uma_zalloc_pcpu(pcpu_zone_64, M_WAITOK | M_ZERO);
1217 mtp_set_subzone(mtp);
1218
1219 mtx_lock(&malloc_mtx);
1220 mtp->ks_next = kmemstatistics;
1221 kmemstatistics = mtp;
1222 kmemcount++;
1223 mtx_unlock(&malloc_mtx);
1224}
1225
1226void
1227malloc_uninit(void *data)

Callers

nothing calls this directly

Calls 5

mtp_set_subzoneFunction · 0.85
panicFunction · 0.70
mtx_lockFunction · 0.70
mtx_unlockFunction · 0.70
uma_zalloc_pcpuFunction · 0.50

Tested by

no test coverage detected