xref: /freebsd/sys/vm/vm_meter.c (revision c0020399a650364d0134f79f3fa319f84064372d)
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
9  *    notice, this list of conditions and the following disclaimer.
10  * 2. Redistributions in binary form must reproduce the above copyright
11  *    notice, this list of conditions and the following disclaimer in the
12  *    documentation and/or other materials provided with the distribution.
13  * 4. Neither the name of the University nor the names of its contributors
14  *    may be used to endorse or promote products derived from this software
15  *    without specific prior written permission.
16  *
17  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
18  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
21  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
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$");
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>
42 #include <sys/sx.h>
43 #include <sys/vmmeter.h>
44 #include <sys/smp.h>
45 
46 #include <vm/vm.h>
47 #include <vm/vm_page.h>
48 #include <vm/vm_extern.h>
49 #include <vm/vm_param.h>
50 #include <vm/pmap.h>
51 #include <vm/vm_map.h>
52 #include <vm/vm_object.h>
53 #include <sys/sysctl.h>
54 
55 struct vmmeter cnt;
56 
57 int maxslp = MAXSLP;
58 
59 SYSCTL_UINT(_vm, VM_V_FREE_MIN, v_free_min,
60 	CTLFLAG_RW, &cnt.v_free_min, 0, "");
61 SYSCTL_UINT(_vm, VM_V_FREE_TARGET, v_free_target,
62 	CTLFLAG_RW, &cnt.v_free_target, 0, "");
63 SYSCTL_UINT(_vm, VM_V_FREE_RESERVED, v_free_reserved,
64 	CTLFLAG_RW, &cnt.v_free_reserved, 0, "");
65 SYSCTL_UINT(_vm, VM_V_INACTIVE_TARGET, v_inactive_target,
66 	CTLFLAG_RW, &cnt.v_inactive_target, 0, "");
67 SYSCTL_UINT(_vm, VM_V_CACHE_MIN, v_cache_min,
68 	CTLFLAG_RW, &cnt.v_cache_min, 0, "");
69 SYSCTL_UINT(_vm, VM_V_CACHE_MAX, v_cache_max,
70 	CTLFLAG_RW, &cnt.v_cache_max, 0, "");
71 SYSCTL_UINT(_vm, VM_V_PAGEOUT_FREE_MIN, v_pageout_free_min,
72 	CTLFLAG_RW, &cnt.v_pageout_free_min, 0, "");
73 SYSCTL_UINT(_vm, OID_AUTO, v_free_severe,
74 	CTLFLAG_RW, &cnt.v_free_severe, 0, "");
75 
76 static int
77 sysctl_vm_loadavg(SYSCTL_HANDLER_ARGS)
78 {
79 
80 #ifdef SCTL_MASK32
81 	u_int32_t la[4];
82 
83 	if (req->flags & SCTL_MASK32) {
84 		la[0] = averunnable.ldavg[0];
85 		la[1] = averunnable.ldavg[1];
86 		la[2] = averunnable.ldavg[2];
87 		la[3] = averunnable.fscale;
88 		return SYSCTL_OUT(req, la, sizeof(la));
89 	} else
90 #endif
91 		return SYSCTL_OUT(req, &averunnable, sizeof(averunnable));
92 }
93 SYSCTL_PROC(_vm, VM_LOADAVG, loadavg, CTLTYPE_STRUCT | CTLFLAG_RD |
94     CTLFLAG_MPSAFE, NULL, 0, sysctl_vm_loadavg, "S,loadavg",
95     "Machine loadaverage history");
96 
97 static int
98 vmtotal(SYSCTL_HANDLER_ARGS)
99 {
100 	struct proc *p;
101 	struct vmtotal total;
102 	vm_map_entry_t entry;
103 	vm_object_t object;
104 	vm_map_t map;
105 	int paging;
106 	struct thread *td;
107 	struct vmspace *vm;
108 
109 	bzero(&total, sizeof(total));
110 	/*
111 	 * Mark all objects as inactive.
112 	 */
113 	mtx_lock(&vm_object_list_mtx);
114 	TAILQ_FOREACH(object, &vm_object_list, object_list) {
115 		if (!VM_OBJECT_TRYLOCK(object)) {
116 			/*
117 			 * Avoid a lock-order reversal.  Consequently,
118 			 * the reported number of active pages may be
119 			 * greater than the actual number.
120 			 */
121 			continue;
122 		}
123 		vm_object_clear_flag(object, OBJ_ACTIVE);
124 		VM_OBJECT_UNLOCK(object);
125 	}
126 	mtx_unlock(&vm_object_list_mtx);
127 	/*
128 	 * Calculate process statistics.
129 	 */
130 	sx_slock(&allproc_lock);
131 	FOREACH_PROC_IN_SYSTEM(p) {
132 		if (p->p_flag & P_SYSTEM)
133 			continue;
134 		PROC_LOCK(p);
135 		PROC_SLOCK(p);
136 		switch (p->p_state) {
137 		case PRS_NEW:
138 			PROC_SUNLOCK(p);
139 			PROC_UNLOCK(p);
140 			continue;
141 			break;
142 		default:
143 			PROC_SUNLOCK(p);
144 			FOREACH_THREAD_IN_PROC(p, td) {
145 				thread_lock(td);
146 				switch (td->td_state) {
147 				case TDS_INHIBITED:
148 					if (TD_IS_SWAPPED(td))
149 						total.t_sw++;
150 					else if (TD_IS_SLEEPING(td) &&
151 					    td->td_priority <= PZERO)
152 						total.t_dw++;
153 					else
154 						total.t_sl++;
155 					break;
156 
157 				case TDS_CAN_RUN:
158 					total.t_sw++;
159 					break;
160 				case TDS_RUNQ:
161 				case TDS_RUNNING:
162 					total.t_rq++;
163 					thread_unlock(td);
164 					continue;
165 				default:
166 					break;
167 				}
168 				thread_unlock(td);
169 			}
170 		}
171 		PROC_UNLOCK(p);
172 		/*
173 		 * Note active objects.
174 		 */
175 		paging = 0;
176 		vm = vmspace_acquire_ref(p);
177 		if (vm == NULL)
178 			continue;
179 		map = &vm->vm_map;
180 		vm_map_lock_read(map);
181 		for (entry = map->header.next;
182 		    entry != &map->header; entry = entry->next) {
183 			if ((entry->eflags & MAP_ENTRY_IS_SUB_MAP) ||
184 			    (object = entry->object.vm_object) == NULL)
185 				continue;
186 			VM_OBJECT_LOCK(object);
187 			vm_object_set_flag(object, OBJ_ACTIVE);
188 			paging |= object->paging_in_progress;
189 			VM_OBJECT_UNLOCK(object);
190 		}
191 		vm_map_unlock_read(map);
192 		vmspace_free(vm);
193 		if (paging)
194 			total.t_pw++;
195 	}
196 	sx_sunlock(&allproc_lock);
197 	/*
198 	 * Calculate object memory usage statistics.
199 	 */
200 	mtx_lock(&vm_object_list_mtx);
201 	TAILQ_FOREACH(object, &vm_object_list, object_list) {
202 		/*
203 		 * Perform unsynchronized reads on the object to avoid
204 		 * a lock-order reversal.  In this case, the lack of
205 		 * synchronization should not impair the accuracy of
206 		 * the reported statistics.
207 		 */
208 		if (object->type == OBJT_DEVICE) {
209 			/*
210 			 * Devices, like /dev/mem, will badly skew our totals.
211 			 */
212 			continue;
213 		}
214 		if (object->ref_count == 0) {
215 			/*
216 			 * Also skip unreferenced objects, including
217 			 * vnodes representing mounted file systems.
218 			 */
219 			continue;
220 		}
221 		total.t_vm += object->size;
222 		total.t_rm += object->resident_page_count;
223 		if (object->flags & OBJ_ACTIVE) {
224 			total.t_avm += object->size;
225 			total.t_arm += object->resident_page_count;
226 		}
227 		if (object->shadow_count > 1) {
228 			/* shared object */
229 			total.t_vmshr += object->size;
230 			total.t_rmshr += object->resident_page_count;
231 			if (object->flags & OBJ_ACTIVE) {
232 				total.t_avmshr += object->size;
233 				total.t_armshr += object->resident_page_count;
234 			}
235 		}
236 	}
237 	mtx_unlock(&vm_object_list_mtx);
238 	total.t_free = cnt.v_free_count + cnt.v_cache_count;
239 	return (sysctl_handle_opaque(oidp, &total, sizeof(total), req));
240 }
241 
242 /*
243  * vcnt() -	accumulate statistics from all cpus and the global cnt
244  *		structure.
245  *
246  *	The vmmeter structure is now per-cpu as well as global.  Those
247  *	statistics which can be kept on a per-cpu basis (to avoid cache
248  *	stalls between cpus) can be moved to the per-cpu vmmeter.  Remaining
249  *	statistics, such as v_free_reserved, are left in the global
250  *	structure.
251  *
252  * (sysctl_oid *oidp, void *arg1, int arg2, struct sysctl_req *req)
253  */
254 static int
255 vcnt(SYSCTL_HANDLER_ARGS)
256 {
257 	int count = *(int *)arg1;
258 	int offset = (char *)arg1 - (char *)&cnt;
259 #ifdef SMP
260 	int i;
261 
262 	for (i = 0; i < mp_ncpus; ++i) {
263 		struct pcpu *pcpu = pcpu_find(i);
264 		count += *(int *)((char *)&pcpu->pc_cnt + offset);
265 	}
266 #else
267 	count += *(int *)((char *)PCPU_PTR(cnt) + offset);
268 #endif
269 	return (SYSCTL_OUT(req, &count, sizeof(int)));
270 }
271 
272 SYSCTL_PROC(_vm, VM_TOTAL, vmtotal, CTLTYPE_OPAQUE|CTLFLAG_RD|CTLFLAG_MPSAFE,
273     0, sizeof(struct vmtotal), vmtotal, "S,vmtotal",
274     "System virtual memory statistics");
275 SYSCTL_NODE(_vm, OID_AUTO, stats, CTLFLAG_RW, 0, "VM meter stats");
276 static SYSCTL_NODE(_vm_stats, OID_AUTO, sys, CTLFLAG_RW, 0,
277 	"VM meter sys stats");
278 static SYSCTL_NODE(_vm_stats, OID_AUTO, vm, CTLFLAG_RW, 0,
279 	"VM meter vm stats");
280 SYSCTL_NODE(_vm_stats, OID_AUTO, misc, CTLFLAG_RW, 0, "VM meter misc stats");
281 
282 SYSCTL_PROC(_vm_stats_sys, OID_AUTO, v_swtch, CTLTYPE_UINT|CTLFLAG_RD|CTLFLAG_MPSAFE,
283 	&cnt.v_swtch, 0, vcnt, "IU", "Context switches");
284 SYSCTL_PROC(_vm_stats_sys, OID_AUTO, v_trap, CTLTYPE_UINT|CTLFLAG_RD|CTLFLAG_MPSAFE,
285 	&cnt.v_trap, 0, vcnt, "IU", "Traps");
286 SYSCTL_PROC(_vm_stats_sys, OID_AUTO, v_syscall, CTLTYPE_UINT|CTLFLAG_RD|CTLFLAG_MPSAFE,
287 	&cnt.v_syscall, 0, vcnt, "IU", "Syscalls");
288 SYSCTL_PROC(_vm_stats_sys, OID_AUTO, v_intr, CTLTYPE_UINT|CTLFLAG_RD|CTLFLAG_MPSAFE,
289 	&cnt.v_intr, 0, vcnt, "IU", "Hardware interrupts");
290 SYSCTL_PROC(_vm_stats_sys, OID_AUTO, v_soft, CTLTYPE_UINT|CTLFLAG_RD|CTLFLAG_MPSAFE,
291 	&cnt.v_soft, 0, vcnt, "IU", "Software interrupts");
292 SYSCTL_PROC(_vm_stats_vm, OID_AUTO, v_vm_faults, CTLTYPE_UINT|CTLFLAG_RD|CTLFLAG_MPSAFE,
293 	&cnt.v_vm_faults, 0, vcnt, "IU", "VM faults");
294 SYSCTL_PROC(_vm_stats_vm, OID_AUTO, v_cow_faults, CTLTYPE_UINT|CTLFLAG_RD|CTLFLAG_MPSAFE,
295 	&cnt.v_cow_faults, 0, vcnt, "IU", "COW faults");
296 SYSCTL_PROC(_vm_stats_vm, OID_AUTO, v_cow_optim, CTLTYPE_UINT|CTLFLAG_RD|CTLFLAG_MPSAFE,
297 	&cnt.v_cow_optim, 0, vcnt, "IU", "Optimized COW faults");
298 SYSCTL_PROC(_vm_stats_vm, OID_AUTO, v_zfod, CTLTYPE_UINT|CTLFLAG_RD|CTLFLAG_MPSAFE,
299 	&cnt.v_zfod, 0, vcnt, "IU", "Zero fill");
300 SYSCTL_PROC(_vm_stats_vm, OID_AUTO, v_ozfod, CTLTYPE_UINT|CTLFLAG_RD|CTLFLAG_MPSAFE,
301 	&cnt.v_ozfod, 0, vcnt, "IU", "Optimized zero fill");
302 SYSCTL_PROC(_vm_stats_vm, OID_AUTO, v_swapin, CTLTYPE_UINT|CTLFLAG_RD|CTLFLAG_MPSAFE,
303 	&cnt.v_swapin, 0, vcnt, "IU", "Swapin operations");
304 SYSCTL_PROC(_vm_stats_vm, OID_AUTO, v_swapout, CTLTYPE_UINT|CTLFLAG_RD|CTLFLAG_MPSAFE,
305 	&cnt.v_swapout, 0, vcnt, "IU", "Swapout operations");
306 SYSCTL_PROC(_vm_stats_vm, OID_AUTO, v_swappgsin, CTLTYPE_UINT|CTLFLAG_RD|CTLFLAG_MPSAFE,
307 	&cnt.v_swappgsin, 0, vcnt, "IU", "Swapin pages");
308 SYSCTL_PROC(_vm_stats_vm, OID_AUTO, v_swappgsout, CTLTYPE_UINT|CTLFLAG_RD|CTLFLAG_MPSAFE,
309 	&cnt.v_swappgsout, 0, vcnt, "IU", "Swapout pages");
310 SYSCTL_PROC(_vm_stats_vm, OID_AUTO, v_vnodein, CTLTYPE_UINT|CTLFLAG_RD|CTLFLAG_MPSAFE,
311 	&cnt.v_vnodein, 0, vcnt, "IU", "Vnodein operations");
312 SYSCTL_PROC(_vm_stats_vm, OID_AUTO, v_vnodeout, CTLTYPE_UINT|CTLFLAG_RD|CTLFLAG_MPSAFE,
313 	&cnt.v_vnodeout, 0, vcnt, "IU", "Vnodeout operations");
314 SYSCTL_PROC(_vm_stats_vm, OID_AUTO, v_vnodepgsin, CTLTYPE_UINT|CTLFLAG_RD|CTLFLAG_MPSAFE,
315 	&cnt.v_vnodepgsin, 0, vcnt, "IU", "Vnodein pages");
316 SYSCTL_PROC(_vm_stats_vm, OID_AUTO, v_vnodepgsout, CTLTYPE_UINT|CTLFLAG_RD|CTLFLAG_MPSAFE,
317 	&cnt.v_vnodepgsout, 0, vcnt, "IU", "Vnodeout pages");
318 SYSCTL_PROC(_vm_stats_vm, OID_AUTO, v_intrans, CTLTYPE_UINT|CTLFLAG_RD|CTLFLAG_MPSAFE,
319 	&cnt.v_intrans, 0, vcnt, "IU", "In transit page blocking");
320 SYSCTL_PROC(_vm_stats_vm, OID_AUTO, v_reactivated, CTLTYPE_UINT|CTLFLAG_RD|CTLFLAG_MPSAFE,
321 	&cnt.v_reactivated, 0, vcnt, "IU", "Reactivated pages");
322 SYSCTL_PROC(_vm_stats_vm, OID_AUTO, v_pdwakeups, CTLTYPE_UINT|CTLFLAG_RD|CTLFLAG_MPSAFE,
323 	&cnt.v_pdwakeups, 0, vcnt, "IU", "Pagedaemon wakeups");
324 SYSCTL_PROC(_vm_stats_vm, OID_AUTO, v_pdpages, CTLTYPE_UINT|CTLFLAG_RD|CTLFLAG_MPSAFE,
325 	&cnt.v_pdpages, 0, vcnt, "IU", "Pagedaemon page scans");
326 SYSCTL_PROC(_vm_stats_vm, OID_AUTO, v_tcached, CTLTYPE_UINT|CTLFLAG_RD|CTLFLAG_MPSAFE,
327 	&cnt.v_tcached, 0, vcnt, "IU", "Total pages cached");
328 SYSCTL_PROC(_vm_stats_vm, OID_AUTO, v_dfree, CTLTYPE_UINT|CTLFLAG_RD|CTLFLAG_MPSAFE,
329 	&cnt.v_dfree, 0, vcnt, "IU", "");
330 SYSCTL_PROC(_vm_stats_vm, OID_AUTO, v_pfree, CTLTYPE_UINT|CTLFLAG_RD|CTLFLAG_MPSAFE,
331 	&cnt.v_pfree, 0, vcnt, "IU", "");
332 SYSCTL_PROC(_vm_stats_vm, OID_AUTO, v_tfree, CTLTYPE_UINT|CTLFLAG_RD|CTLFLAG_MPSAFE,
333 	&cnt.v_tfree, 0, vcnt, "IU", "");
334 SYSCTL_PROC(_vm_stats_vm, OID_AUTO, v_page_size, CTLTYPE_UINT|CTLFLAG_RD|CTLFLAG_MPSAFE,
335 	&cnt.v_page_size, 0, vcnt, "IU", "");
336 SYSCTL_PROC(_vm_stats_vm, OID_AUTO, v_page_count, CTLTYPE_UINT|CTLFLAG_RD|CTLFLAG_MPSAFE,
337 	&cnt.v_page_count, 0, vcnt, "IU", "");
338 SYSCTL_PROC(_vm_stats_vm, OID_AUTO, v_free_reserved, CTLTYPE_UINT|CTLFLAG_RD|CTLFLAG_MPSAFE,
339 	&cnt.v_free_reserved, 0, vcnt, "IU", "");
340 SYSCTL_PROC(_vm_stats_vm, OID_AUTO, v_free_target, CTLTYPE_UINT|CTLFLAG_RD|CTLFLAG_MPSAFE,
341 	&cnt.v_free_target, 0, vcnt, "IU", "");
342 SYSCTL_PROC(_vm_stats_vm, OID_AUTO, v_free_min, CTLTYPE_UINT|CTLFLAG_RD|CTLFLAG_MPSAFE,
343 	&cnt.v_free_min, 0, vcnt, "IU", "");
344 SYSCTL_PROC(_vm_stats_vm, OID_AUTO, v_free_count, CTLTYPE_UINT|CTLFLAG_RD|CTLFLAG_MPSAFE,
345 	&cnt.v_free_count, 0, vcnt, "IU", "");
346 SYSCTL_PROC(_vm_stats_vm, OID_AUTO, v_wire_count, CTLTYPE_UINT|CTLFLAG_RD|CTLFLAG_MPSAFE,
347 	&cnt.v_wire_count, 0, vcnt, "IU", "");
348 SYSCTL_PROC(_vm_stats_vm, OID_AUTO, v_active_count, CTLTYPE_UINT|CTLFLAG_RD|CTLFLAG_MPSAFE,
349 	&cnt.v_active_count, 0, vcnt, "IU", "");
350 SYSCTL_PROC(_vm_stats_vm, OID_AUTO, v_inactive_target, CTLTYPE_UINT|CTLFLAG_RD|CTLFLAG_MPSAFE,
351 	&cnt.v_inactive_target, 0, vcnt, "IU", "");
352 SYSCTL_PROC(_vm_stats_vm, OID_AUTO, v_inactive_count, CTLTYPE_UINT|CTLFLAG_RD|CTLFLAG_MPSAFE,
353 	&cnt.v_inactive_count, 0, vcnt, "IU", "");
354 SYSCTL_PROC(_vm_stats_vm, OID_AUTO, v_cache_count, CTLTYPE_UINT|CTLFLAG_RD|CTLFLAG_MPSAFE,
355 	&cnt.v_cache_count, 0, vcnt, "IU", "");
356 SYSCTL_PROC(_vm_stats_vm, OID_AUTO, v_cache_min, CTLTYPE_UINT|CTLFLAG_RD|CTLFLAG_MPSAFE,
357 	&cnt.v_cache_min, 0, vcnt, "IU", "");
358 SYSCTL_PROC(_vm_stats_vm, OID_AUTO, v_cache_max, CTLTYPE_UINT|CTLFLAG_RD|CTLFLAG_MPSAFE,
359 	&cnt.v_cache_max, 0, vcnt, "IU", "");
360 SYSCTL_PROC(_vm_stats_vm, OID_AUTO, v_pageout_free_min, CTLTYPE_UINT|CTLFLAG_RD|CTLFLAG_MPSAFE,
361 	&cnt.v_pageout_free_min, 0, vcnt, "IU", "");
362 SYSCTL_PROC(_vm_stats_vm, OID_AUTO, v_interrupt_free_min, CTLTYPE_UINT|CTLFLAG_RD|CTLFLAG_MPSAFE,
363 	&cnt.v_interrupt_free_min, 0, vcnt, "IU", "");
364 SYSCTL_PROC(_vm_stats_vm, OID_AUTO, v_forks, CTLTYPE_UINT|CTLFLAG_RD|CTLFLAG_MPSAFE,
365 	&cnt.v_forks, 0, vcnt, "IU", "Number of fork() calls");
366 SYSCTL_PROC(_vm_stats_vm, OID_AUTO, v_vforks, CTLTYPE_UINT|CTLFLAG_RD|CTLFLAG_MPSAFE,
367 	&cnt.v_vforks, 0, vcnt, "IU", "Number of vfork() calls");
368 SYSCTL_PROC(_vm_stats_vm, OID_AUTO, v_rforks, CTLTYPE_UINT|CTLFLAG_RD|CTLFLAG_MPSAFE,
369 	&cnt.v_rforks, 0, vcnt, "IU", "Number of rfork() calls");
370 SYSCTL_PROC(_vm_stats_vm, OID_AUTO, v_kthreads, CTLTYPE_UINT|CTLFLAG_RD|CTLFLAG_MPSAFE,
371 	&cnt.v_kthreads, 0, vcnt, "IU", "Number of fork() calls by kernel");
372 SYSCTL_PROC(_vm_stats_vm, OID_AUTO, v_forkpages, CTLTYPE_UINT|CTLFLAG_RD|CTLFLAG_MPSAFE,
373 	&cnt.v_forkpages, 0, vcnt, "IU", "VM pages affected by fork()");
374 SYSCTL_PROC(_vm_stats_vm, OID_AUTO, v_vforkpages, CTLTYPE_UINT|CTLFLAG_RD|CTLFLAG_MPSAFE,
375 	&cnt.v_vforkpages, 0, vcnt, "IU", "VM pages affected by vfork()");
376 SYSCTL_PROC(_vm_stats_vm, OID_AUTO, v_rforkpages, CTLTYPE_UINT|CTLFLAG_RD|CTLFLAG_MPSAFE,
377 	&cnt.v_rforkpages, 0, vcnt, "IU", "VM pages affected by rfork()");
378 SYSCTL_PROC(_vm_stats_vm, OID_AUTO, v_kthreadpages, CTLTYPE_UINT|CTLFLAG_RD|CTLFLAG_MPSAFE,
379 	&cnt.v_kthreadpages, 0, vcnt, "IU", "VM pages affected by fork() by kernel");
380 
381 SYSCTL_INT(_vm_stats_misc, OID_AUTO,
382 	zero_page_count, CTLFLAG_RD, &vm_page_zero_count, 0, "");
383