vm_meter.c (6cec9cad762b6476313fb1f8e931a1647822db6b) vm_meter.c (e735691b613c2ac4aed254ffefeef429c91c2e0d)
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

--- 97 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) {
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

--- 97 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 ---