* 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(). */
| 256 | * kmapent_alloc() and in vm_map_entry_create(). |
| 257 | */ |
| 258 | void |
| 259 | vm_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 | |
| 289 | static int |
| 290 | vmspace_zinit(void *mem, int size, int flags) |
no test coverage detected