vm_meter.c (146017) | vm_meter.c (159054) |
---|---|
1/*- 2 * Copyright (c) 1982, 1986, 1989, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 16 unchanged lines hidden (view full) --- 25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 27 * SUCH DAMAGE. 28 * 29 * @(#)vm_meter.c 8.4 (Berkeley) 1/4/94 30 */ 31 32#include <sys/cdefs.h> | 1/*- 2 * Copyright (c) 1982, 1986, 1989, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 16 unchanged lines hidden (view full) --- 25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 27 * SUCH DAMAGE. 28 * 29 * @(#)vm_meter.c 8.4 (Berkeley) 1/4/94 30 */ 31 32#include <sys/cdefs.h> |
33__FBSDID("$FreeBSD: head/sys/vm/vm_meter.c 146017 2005-05-08 23:56:16Z marcel $"); | 33__FBSDID("$FreeBSD: head/sys/vm/vm_meter.c 159054 2006-05-29 21:28:56Z tegge $"); |
34 35#include <sys/param.h> 36#include <sys/systm.h> 37#include <sys/kernel.h> 38#include <sys/lock.h> 39#include <sys/mutex.h> 40#include <sys/proc.h> 41#include <sys/resource.h> --- 68 unchanged lines hidden (view full) --- 110/* XXXKSE almost completely broken */ 111 struct proc *p; 112 struct vmtotal total, *totalp; 113 vm_map_entry_t entry; 114 vm_object_t object; 115 vm_map_t map; 116 int paging; 117 struct thread *td; | 34 35#include <sys/param.h> 36#include <sys/systm.h> 37#include <sys/kernel.h> 38#include <sys/lock.h> 39#include <sys/mutex.h> 40#include <sys/proc.h> 41#include <sys/resource.h> --- 68 unchanged lines hidden (view full) --- 110/* XXXKSE almost completely broken */ 111 struct proc *p; 112 struct vmtotal total, *totalp; 113 vm_map_entry_t entry; 114 vm_object_t object; 115 vm_map_t map; 116 int paging; 117 struct thread *td; |
118 struct vmspace *vm; |
|
118 119 totalp = &total; 120 bzero(totalp, sizeof *totalp); 121 /* 122 * Mark all objects as inactive. 123 */ 124 GIANT_REQUIRED; 125 mtx_lock(&vm_object_list_mtx); --- 54 unchanged lines hidden (view full) --- 180 } 181 } 182 } 183 mtx_unlock_spin(&sched_lock); 184 /* 185 * Note active objects. 186 */ 187 paging = 0; | 119 120 totalp = &total; 121 bzero(totalp, sizeof *totalp); 122 /* 123 * Mark all objects as inactive. 124 */ 125 GIANT_REQUIRED; 126 mtx_lock(&vm_object_list_mtx); --- 54 unchanged lines hidden (view full) --- 181 } 182 } 183 } 184 mtx_unlock_spin(&sched_lock); 185 /* 186 * Note active objects. 187 */ 188 paging = 0; |
188 map = &p->p_vmspace->vm_map; | 189 vm = vmspace_acquire_ref(p); 190 if (vm == NULL) 191 continue; 192 map = &vm->vm_map; |
189 vm_map_lock_read(map); 190 for (entry = map->header.next; 191 entry != &map->header; entry = entry->next) { 192 if ((entry->eflags & MAP_ENTRY_IS_SUB_MAP) || 193 (object = entry->object.vm_object) == NULL) 194 continue; 195 VM_OBJECT_LOCK(object); 196 vm_object_set_flag(object, OBJ_ACTIVE); 197 paging |= object->paging_in_progress; 198 VM_OBJECT_UNLOCK(object); 199 } 200 vm_map_unlock_read(map); | 193 vm_map_lock_read(map); 194 for (entry = map->header.next; 195 entry != &map->header; entry = entry->next) { 196 if ((entry->eflags & MAP_ENTRY_IS_SUB_MAP) || 197 (object = entry->object.vm_object) == NULL) 198 continue; 199 VM_OBJECT_LOCK(object); 200 vm_object_set_flag(object, OBJ_ACTIVE); 201 paging |= object->paging_in_progress; 202 VM_OBJECT_UNLOCK(object); 203 } 204 vm_map_unlock_read(map); |
205 vmspace_free(vm); |
|
201 if (paging) 202 totalp->t_pw++; 203 } 204 sx_sunlock(&allproc_lock); 205 /* 206 * Calculate object memory usage statistics. 207 */ 208 mtx_lock(&vm_object_list_mtx); --- 183 unchanged lines hidden --- | 206 if (paging) 207 totalp->t_pw++; 208 } 209 sx_sunlock(&allproc_lock); 210 /* 211 * Calculate object memory usage statistics. 212 */ 213 mtx_lock(&vm_object_list_mtx); --- 183 unchanged lines hidden --- |