| 362 | #endif |
| 363 | |
| 364 | static inline void |
| 365 | vmspace_dofree(struct vmspace *vm) |
| 366 | { |
| 367 | |
| 368 | CTR1(KTR_VM, "vmspace_free: %p", vm); |
| 369 | |
| 370 | /* |
| 371 | * Make sure any SysV shm is freed, it might not have been in |
| 372 | * exit1(). |
| 373 | */ |
| 374 | shmexit(vm); |
| 375 | |
| 376 | /* |
| 377 | * Lock the map, to wait out all other references to it. |
| 378 | * Delete all of the mappings and pages they hold, then call |
| 379 | * the pmap module to reclaim anything left. |
| 380 | */ |
| 381 | (void)vm_map_remove(&vm->vm_map, vm_map_min(&vm->vm_map), |
| 382 | vm_map_max(&vm->vm_map)); |
| 383 | |
| 384 | pmap_release(vmspace_pmap(vm)); |
| 385 | vm->vm_map.pmap = NULL; |
| 386 | uma_zfree(vmspace_zone, vm); |
| 387 | } |
| 388 | |
| 389 | void |
| 390 | vmspace_free(struct vmspace *vm) |
no test coverage detected