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

Function vm_map_startup

freebsd/vm/vm_map.c:258–287  ·  view source on GitHub ↗

* vm_map_startup: * * Initialize the vm_map module. Must be called before any other vm_map * routines. * * User map and entry structures are allocated from the general purpose * memory pool. Kernel maps are statically defined. Kernel map entries * require special handling to avoid recursion; see the comments above * kmapent_alloc() and in vm_map_entry_create(). */

Source from the content-addressed store, hash-verified

256 * kmapent_alloc() and in vm_map_entry_create().
257 */
258void
259vm_map_startup(void)
260{
261 mtx_init(&map_sleep_mtx, "vm map sleep mutex", NULL, MTX_DEF);
262
263 /*
264 * Disable the use of per-CPU buckets: map entry allocation is
265 * serialized by the kernel map lock.
266 */
267 kmapentzone = uma_zcreate("KMAP ENTRY", sizeof(struct vm_map_entry),
268 NULL, NULL, NULL, NULL, UMA_ALIGN_PTR,
269 UMA_ZONE_VM | UMA_ZONE_NOBUCKET);
270#ifndef UMA_MD_SMALL_ALLOC
271 /* Reserve an extra map entry for use when replenishing the reserve. */
272 uma_zone_reserve(kmapentzone, KMAPENT_RESERVE + 1);
273 uma_prealloc(kmapentzone, KMAPENT_RESERVE + 1);
274 uma_zone_set_allocf(kmapentzone, kmapent_alloc);
275 uma_zone_set_freef(kmapentzone, kmapent_free);
276#endif
277
278 mapentzone = uma_zcreate("MAP ENTRY", sizeof(struct vm_map_entry),
279 NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, 0);
280 vmspace_zone = uma_zcreate("VMSPACE", sizeof(struct vmspace), NULL,
281#ifdef INVARIANTS
282 vmspace_zdtor,
283#else
284 NULL,
285#endif
286 vmspace_zinit, NULL, UMA_ALIGN_PTR, UMA_ZONE_NOFREE);
287}
288
289static int
290vmspace_zinit(void *mem, int size, int flags)

Callers 1

vm_mem_initFunction · 0.85

Calls 6

mtx_initFunction · 0.85
uma_zcreateFunction · 0.85
uma_zone_reserveFunction · 0.85
uma_preallocFunction · 0.85
uma_zone_set_allocfFunction · 0.85
uma_zone_set_freefFunction · 0.85

Tested by

no test coverage detected