summaryrefslogtreecommitdiffstats
path: root/sys/vm/vm_map.c
diff options
context:
space:
mode:
authorphk <phk@FreeBSD.org>2003-07-18 10:47:58 +0000
committerphk <phk@FreeBSD.org>2003-07-18 10:47:58 +0000
commitaa8896f3b8851237470823d4b6b9e14b8943d806 (patch)
treebcc30ab6e5251465bb34f2340ddb08d968c1e1d2 /sys/vm/vm_map.c
parent5fa40a32657fa0c3bd8a986099bb65516d11e97b (diff)
downloadFreeBSD-src-aa8896f3b8851237470823d4b6b9e14b8943d806.zip
FreeBSD-src-aa8896f3b8851237470823d4b6b9e14b8943d806.tar.gz
Move the implementation of the vmspace_swap_count() (used only in
the "toss the largest process" emergency handling) from vm_map.c to swap_pager.c. The quantity calculated depends strongly on the internals of the swap_pager and by moving it, we no longer need to expose the internal metrics of the swap_pager to the world.
Diffstat (limited to 'sys/vm/vm_map.c')
-rw-r--r--sys/vm/vm_map.c37
1 files changed, 0 insertions, 37 deletions
diff --git a/sys/vm/vm_map.c b/sys/vm/vm_map.c
index fdfb63c..eddfc88 100644
--- a/sys/vm/vm_map.c
+++ b/sys/vm/vm_map.c
@@ -342,43 +342,6 @@ vmspace_exitfree(struct proc *p)
vmspace_dofree(vm);
}
-/*
- * vmspace_swap_count() - count the approximate swap useage in pages for a
- * vmspace.
- *
- * The map must be locked.
- *
- * Swap useage is determined by taking the proportional swap used by
- * VM objects backing the VM map. To make up for fractional losses,
- * if the VM object has any swap use at all the associated map entries
- * count for at least 1 swap page.
- */
-int
-vmspace_swap_count(struct vmspace *vmspace)
-{
- vm_map_t map = &vmspace->vm_map;
- vm_map_entry_t cur;
- int count = 0;
-
- for (cur = map->header.next; cur != &map->header; cur = cur->next) {
- vm_object_t object;
-
- if ((cur->eflags & MAP_ENTRY_IS_SUB_MAP) == 0 &&
- (object = cur->object.vm_object) != NULL) {
- VM_OBJECT_LOCK(object);
- if (object->type == OBJT_SWAP &&
- object->un_pager.swp.swp_bcount != 0) {
- int n = (cur->end - cur->start) / PAGE_SIZE;
-
- count += object->un_pager.swp.swp_bcount *
- SWAP_META_PAGES * n / object->size + 1;
- }
- VM_OBJECT_UNLOCK(object);
- }
- }
- return (count);
-}
-
void
_vm_map_lock(vm_map_t map, const char *file, int line)
{
OpenPOWER on IntegriCloud