Lines Matching +full:vm +full:- +full:map
1 /*-
2 * SPDX-License-Identifier: (BSD-4-Clause AND MIT-CMU)
14 * The Mach Operating System project at Carnegie-Mellon University.
45 * Copyright (c) 1987, 1990 Carnegie-Mellon University.
65 * Pittsburgh PA 15213-3890
100 #include <vm/vm.h>
101 #include <vm/vm_param.h>
102 #include <vm/vm_kern.h>
103 #include <vm/vm_object.h>
104 #include <vm/vm_page.h>
105 #include <vm/vm_map.h>
106 #include <vm/vm_pageout.h>
107 #include <vm/vm_pager.h>
108 #include <vm/vm_phys.h>
109 #include <vm/vm_radix.h>
110 #include <vm/swap_pager.h>
111 #include <vm/vm_extern.h>
112 #include <vm/uma.h>
133 MTX_SYSINIT(vm_daemon, &vm_daemon_mtx, "vm daemon", MTX_DEF);
168 * The object and map must be locked.
180 if ((first_object->flags & OBJ_FICTITIOUS) != 0) in vm_swapout_object_deactivate()
186 if ((object->flags & OBJ_UNMANAGED) != 0 || in vm_swapout_object_deactivate()
187 blockcount_read(&object->paging_in_progress) > 0) in vm_swapout_object_deactivate()
191 if (object->shadow_count > 1) in vm_swapout_object_deactivate()
205 if ((backing_object = object->backing_object) == NULL) in vm_swapout_object_deactivate()
217 * deactivate some number of pages in a map, try to do it fairly, but
221 vm_swapout_map_deactivate_pages(vm_map_t map, long desired) in vm_swapout_map_deactivate_pages() argument
227 if (!vm_map_trylock_read(map)) in vm_swapout_map_deactivate_pages()
237 VM_MAP_ENTRY_FOREACH(tmpe, map) { in vm_swapout_map_deactivate_pages()
238 if ((tmpe->eflags & MAP_ENTRY_IS_SUB_MAP) == 0) { in vm_swapout_map_deactivate_pages()
239 obj = tmpe->object.vm_object; in vm_swapout_map_deactivate_pages()
241 if (obj->shadow_count <= 1 && in vm_swapout_map_deactivate_pages()
243 bigobj->resident_page_count < in vm_swapout_map_deactivate_pages()
244 obj->resident_page_count)) { in vm_swapout_map_deactivate_pages()
252 if (tmpe->wired_count > 0) in vm_swapout_map_deactivate_pages()
257 vm_swapout_object_deactivate(map->pmap, bigobj, desired); in vm_swapout_map_deactivate_pages()
262 * do this search sort of wrong -- .text first is not the best idea. in vm_swapout_map_deactivate_pages()
264 VM_MAP_ENTRY_FOREACH(tmpe, map) { in vm_swapout_map_deactivate_pages()
265 if (pmap_resident_count(vm_map_pmap(map)) <= desired) in vm_swapout_map_deactivate_pages()
267 if ((tmpe->eflags & MAP_ENTRY_IS_SUB_MAP) == 0) { in vm_swapout_map_deactivate_pages()
268 obj = tmpe->object.vm_object; in vm_swapout_map_deactivate_pages()
271 vm_swapout_object_deactivate(map->pmap, obj, in vm_swapout_map_deactivate_pages()
283 pmap_remove(vm_map_pmap(map), vm_map_min(map), in vm_swapout_map_deactivate_pages()
284 vm_map_max(map)); in vm_swapout_map_deactivate_pages()
287 vm_map_unlock_read(map); in vm_swapout_map_deactivate_pages()
296 struct vmspace *vm; in vm_daemon() local
311 * process is swapped out -- deactivate pages in vm_daemon()
326 if (p->p_state != PRS_NORMAL || in vm_daemon()
327 p->p_flag & (P_INEXEC | P_SYSTEM | P_WEXIT)) { in vm_daemon()
332 * if the process is in a non-running type state, in vm_daemon()
359 vm = vmspace_acquire_ref(p); in vm_daemon()
362 if (vm == NULL) { in vm_daemon()
368 size = vmspace_resident_count(vm); in vm_daemon()
371 &vm->vm_map, limit); in vm_daemon()
372 size = vmspace_resident_count(vm); in vm_daemon()
377 if (p->p_state == PRS_NORMAL) in vm_daemon()
391 if (ravailable < rsize - in vm_daemon()
393 ravailable = rsize - in vm_daemon()
398 &vm->vm_map, in vm_daemon()
401 size = vmspace_resident_count(vm); in vm_daemon()
404 if (p->p_state == PRS_NORMAL) in vm_daemon()
411 vmspace_free(vm); in vm_daemon()