Deleted Added
full compact
vm_meter.c (256281) vm_meter.c (284100)
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: stable/10/sys/vm/vm_meter.c 248084 2013-03-09 02:32:23Z attilio $");
33__FBSDID("$FreeBSD: stable/10/sys/vm/vm_meter.c 284100 2015-06-06 20:37:40Z jhb $");
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>

--- 64 unchanged lines hidden (view full) ---

106 struct vmspace *vm;
107
108 bzero(&total, sizeof(total));
109 /*
110 * Mark all objects as inactive.
111 */
112 mtx_lock(&vm_object_list_mtx);
113 TAILQ_FOREACH(object, &vm_object_list, object_list) {
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>

--- 64 unchanged lines hidden (view full) ---

106 struct vmspace *vm;
107
108 bzero(&total, sizeof(total));
109 /*
110 * Mark all objects as inactive.
111 */
112 mtx_lock(&vm_object_list_mtx);
113 TAILQ_FOREACH(object, &vm_object_list, object_list) {
114 if (!VM_OBJECT_TRYWLOCK(object)) {
115 /*
116 * Avoid a lock-order reversal. Consequently,
117 * the reported number of active pages may be
118 * greater than the actual number.
119 */
120 continue;
121 }
114 VM_OBJECT_WLOCK(object);
122 vm_object_clear_flag(object, OBJ_ACTIVE);
123 VM_OBJECT_WUNLOCK(object);
124 }
125 mtx_unlock(&vm_object_list_mtx);
126 /*
127 * Calculate process statistics.
128 */
129 sx_slock(&allproc_lock);

--- 61 unchanged lines hidden (view full) ---

191 }
192 sx_sunlock(&allproc_lock);
193 /*
194 * Calculate object memory usage statistics.
195 */
196 mtx_lock(&vm_object_list_mtx);
197 TAILQ_FOREACH(object, &vm_object_list, object_list) {
198 /*
115 vm_object_clear_flag(object, OBJ_ACTIVE);
116 VM_OBJECT_WUNLOCK(object);
117 }
118 mtx_unlock(&vm_object_list_mtx);
119 /*
120 * Calculate process statistics.
121 */
122 sx_slock(&allproc_lock);

--- 61 unchanged lines hidden (view full) ---

184 }
185 sx_sunlock(&allproc_lock);
186 /*
187 * Calculate object memory usage statistics.
188 */
189 mtx_lock(&vm_object_list_mtx);
190 TAILQ_FOREACH(object, &vm_object_list, object_list) {
191 /*
199 * Perform unsynchronized reads on the object to avoid
200 * a lock-order reversal. In this case, the lack of
201 * synchronization should not impair the accuracy of
202 * the reported statistics.
192 * Perform unsynchronized reads on the object. In
193 * this case, the lack of synchronization should not
194 * impair the accuracy of the reported statistics.
203 */
204 if ((object->flags & OBJ_FICTITIOUS) != 0) {
205 /*
206 * Devices, like /dev/mem, will badly skew our totals.
207 */
208 continue;
209 }
210 if (object->ref_count == 0) {

--- 123 unchanged lines hidden ---
195 */
196 if ((object->flags & OBJ_FICTITIOUS) != 0) {
197 /*
198 * Devices, like /dev/mem, will badly skew our totals.
199 */
200 continue;
201 }
202 if (object->ref_count == 0) {

--- 123 unchanged lines hidden ---