xref: /freebsd/sys/kern/subr_param.c (revision e9a3f7852d754fe0af27fae7e7215ca9db8d328f)
19454b2d8SWarner Losh /*-
2df8bae1dSRodney W. Grimes  * Copyright (c) 1980, 1986, 1989, 1993
3df8bae1dSRodney W. Grimes  *	The Regents of the University of California.  All rights reserved.
4df8bae1dSRodney W. Grimes  * (c) UNIX System Laboratories, Inc.
5df8bae1dSRodney W. Grimes  * All or some portions of this file are derived from material licensed
6df8bae1dSRodney W. Grimes  * to the University of California by American Telephone and Telegraph
7df8bae1dSRodney W. Grimes  * Co. or Unix System Laboratories, Inc. and are reproduced herein with
8df8bae1dSRodney W. Grimes  * the permission of UNIX System Laboratories, Inc.
9df8bae1dSRodney W. Grimes  *
10df8bae1dSRodney W. Grimes  * Redistribution and use in source and binary forms, with or without
11df8bae1dSRodney W. Grimes  * modification, are permitted provided that the following conditions
12df8bae1dSRodney W. Grimes  * are met:
13df8bae1dSRodney W. Grimes  * 1. Redistributions of source code must retain the above copyright
14df8bae1dSRodney W. Grimes  *    notice, this list of conditions and the following disclaimer.
15df8bae1dSRodney W. Grimes  * 2. Redistributions in binary form must reproduce the above copyright
16df8bae1dSRodney W. Grimes  *    notice, this list of conditions and the following disclaimer in the
17df8bae1dSRodney W. Grimes  *    documentation and/or other materials provided with the distribution.
18df8bae1dSRodney W. Grimes  * 4. Neither the name of the University nor the names of its contributors
19df8bae1dSRodney W. Grimes  *    may be used to endorse or promote products derived from this software
20df8bae1dSRodney W. Grimes  *    without specific prior written permission.
21df8bae1dSRodney W. Grimes  *
22df8bae1dSRodney W. Grimes  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
23df8bae1dSRodney W. Grimes  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24df8bae1dSRodney W. Grimes  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25df8bae1dSRodney W. Grimes  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
26df8bae1dSRodney W. Grimes  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
27df8bae1dSRodney W. Grimes  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
28df8bae1dSRodney W. Grimes  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
29df8bae1dSRodney W. Grimes  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30df8bae1dSRodney W. Grimes  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
31df8bae1dSRodney W. Grimes  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32df8bae1dSRodney W. Grimes  * SUCH DAMAGE.
33df8bae1dSRodney W. Grimes  *
3470b012caSJeffrey Hsu  *	@(#)param.c	8.3 (Berkeley) 8/20/94
35df8bae1dSRodney W. Grimes  */
36df8bae1dSRodney W. Grimes 
37677b542eSDavid E. O'Brien #include <sys/cdefs.h>
38677b542eSDavid E. O'Brien __FBSDID("$FreeBSD$");
39677b542eSDavid E. O'Brien 
404bd49128SPeter Wemm #include "opt_param.h"
414053b05bSSergey Kandaurov #include "opt_msgbuf.h"
42ee342e1bSPeter Wemm #include "opt_maxusers.h"
4350c73f36SGarrett Wollman 
44412f9500SBrooks Davis #include <sys/limits.h>
45df8bae1dSRodney W. Grimes #include <sys/param.h>
46ee342e1bSPeter Wemm #include <sys/systm.h>
47ee342e1bSPeter Wemm #include <sys/kernel.h>
487c45a9c4SAlfred Perlstein #include <sys/sysctl.h>
494053b05bSSergey Kandaurov #include <sys/msgbuf.h>
50df8bae1dSRodney W. Grimes 
51*e9a3f785SAlan Cox #include <vm/vm.h>
527419d1e2SDag-Erling Smørgrav #include <vm/vm_param.h>
53*e9a3f785SAlan Cox #include <vm/pmap.h>
54cbc89bfbSPaul Saab 
55df8bae1dSRodney W. Grimes /*
56df8bae1dSRodney W. Grimes  * System parameter formulae.
57df8bae1dSRodney W. Grimes  */
58df8bae1dSRodney W. Grimes 
59df8bae1dSRodney W. Grimes #ifndef HZ
60bcebf6a1SNathan Whitehorn #  if defined(__mips__) || defined(__arm__)
61df8bae1dSRodney W. Grimes #    define	HZ 100
62bcebf6a1SNathan Whitehorn #  else
63bcebf6a1SNathan Whitehorn #    define	HZ 1000
64df8bae1dSRodney W. Grimes #  endif
657f03c419SMaxim Sobolev #  ifndef HZ_VM
66347e22a6SMike Silbersack #    define	HZ_VM 100
677f03c419SMaxim Sobolev #  endif
687f03c419SMaxim Sobolev #else
697f03c419SMaxim Sobolev #  ifndef HZ_VM
707f03c419SMaxim Sobolev #    define	HZ_VM HZ
717f03c419SMaxim Sobolev #  endif
728f650450SPeter Wemm #endif
73ee342e1bSPeter Wemm #define	NPROC (20 + 16 * maxusers)
74ee342e1bSPeter Wemm #ifndef NBUF
75ee342e1bSPeter Wemm #define NBUF 0
76ee342e1bSPeter Wemm #endif
775a00f364SDag-Erling Smørgrav #ifndef MAXFILES
78ee342e1bSPeter Wemm #define	MAXFILES (maxproc * 2)
795a00f364SDag-Erling Smørgrav #endif
80dd0b2081SDavid Greenman 
813610a226SIvan Voras static int sysctl_kern_vm_guest(SYSCTL_HANDLER_ARGS);
823610a226SIvan Voras 
83ee342e1bSPeter Wemm int	hz;
84ee342e1bSPeter Wemm int	tick;
85ee342e1bSPeter Wemm int	maxusers;			/* base tunable */
86ee342e1bSPeter Wemm int	maxproc;			/* maximum # of processes */
87ee342e1bSPeter Wemm int	maxprocperuid;			/* max # of procs per user */
88ee342e1bSPeter Wemm int	maxfiles;			/* sys. wide open files limit */
89ee342e1bSPeter Wemm int	maxfilesperproc;		/* per-proc open files limit */
904053b05bSSergey Kandaurov int	msgbufsize;			/* size of kernel message buffer */
91ee342e1bSPeter Wemm int	ncallout;			/* maximum # of timer events */
92ee342e1bSPeter Wemm int	nbuf;
93412f9500SBrooks Davis int	ngroups_max;			/* max # groups per process */
94ee342e1bSPeter Wemm int	nswbuf;
955bd65606SJohn Baldwin long	maxswzone;			/* max swmeta KVA storage */
965bd65606SJohn Baldwin long	maxbcache;			/* max buffer cache KVA storage */
9764ecd139SJohn Baldwin long	maxpipekva;			/* Limit on pipe KVA */
983dc30911SIvan Voras int 	vm_guest;			/* Running as virtual machine guest? */
997419d1e2SDag-Erling Smørgrav u_long	maxtsiz;			/* max text size */
1007419d1e2SDag-Erling Smørgrav u_long	dfldsiz;			/* initial data size limit */
1017419d1e2SDag-Erling Smørgrav u_long	maxdsiz;			/* max data size */
1027419d1e2SDag-Erling Smørgrav u_long	dflssiz;			/* initial stack size limit */
1037419d1e2SDag-Erling Smørgrav u_long	maxssiz;			/* max stack size */
1047419d1e2SDag-Erling Smørgrav u_long	sgrowsiz;			/* amount to grow stack */
105df8bae1dSRodney W. Grimes 
1069b84ba1cSJohn Baldwin SYSCTL_INT(_kern, OID_AUTO, hz, CTLFLAG_RDTUN, &hz, 0,
1079b84ba1cSJohn Baldwin     "Number of clock ticks per second");
108b9f2a7daSJohn Baldwin SYSCTL_INT(_kern, OID_AUTO, ncallout, CTLFLAG_RDTUN, &ncallout, 0,
109b9f2a7daSJohn Baldwin     "Number of pre-allocated timer events");
110b9f2a7daSJohn Baldwin SYSCTL_INT(_kern, OID_AUTO, nbuf, CTLFLAG_RDTUN, &nbuf, 0,
1119b84ba1cSJohn Baldwin     "Number of buffers in the buffer cache");
112b9f2a7daSJohn Baldwin SYSCTL_INT(_kern, OID_AUTO, nswbuf, CTLFLAG_RDTUN, &nswbuf, 0,
113b9f2a7daSJohn Baldwin     "Number of swap buffers");
1144053b05bSSergey Kandaurov SYSCTL_INT(_kern, OID_AUTO, msgbufsize, CTLFLAG_RDTUN, &msgbufsize, 0,
1154053b05bSSergey Kandaurov     "Size of the kernel message buffer");
11642dd14baSJohn Baldwin SYSCTL_LONG(_kern, OID_AUTO, maxswzone, CTLFLAG_RDTUN, &maxswzone, 0,
1179b84ba1cSJohn Baldwin     "Maximum memory for swap metadata");
11842dd14baSJohn Baldwin SYSCTL_LONG(_kern, OID_AUTO, maxbcache, CTLFLAG_RDTUN, &maxbcache, 0,
1199b84ba1cSJohn Baldwin     "Maximum value of vfs.maxbufspace");
120b109dd74SPawel Jakub Dawidek SYSCTL_ULONG(_kern, OID_AUTO, maxtsiz, CTLFLAG_RDTUN, &maxtsiz, 0,
1219b84ba1cSJohn Baldwin     "Maximum text size");
122b109dd74SPawel Jakub Dawidek SYSCTL_ULONG(_kern, OID_AUTO, dfldsiz, CTLFLAG_RDTUN, &dfldsiz, 0,
1239b84ba1cSJohn Baldwin     "Initial data size limit");
124b109dd74SPawel Jakub Dawidek SYSCTL_ULONG(_kern, OID_AUTO, maxdsiz, CTLFLAG_RDTUN, &maxdsiz, 0,
1259b84ba1cSJohn Baldwin     "Maximum data size");
126b109dd74SPawel Jakub Dawidek SYSCTL_ULONG(_kern, OID_AUTO, dflssiz, CTLFLAG_RDTUN, &dflssiz, 0,
1279b84ba1cSJohn Baldwin     "Initial stack size limit");
128b109dd74SPawel Jakub Dawidek SYSCTL_ULONG(_kern, OID_AUTO, maxssiz, CTLFLAG_RDTUN, &maxssiz, 0,
1299b84ba1cSJohn Baldwin     "Maximum stack size");
130b109dd74SPawel Jakub Dawidek SYSCTL_ULONG(_kern, OID_AUTO, sgrowsiz, CTLFLAG_RDTUN, &sgrowsiz, 0,
1319b84ba1cSJohn Baldwin     "Amount to grow stack on a stack fault");
1323610a226SIvan Voras SYSCTL_PROC(_kern, OID_AUTO, vm_guest, CTLFLAG_RD | CTLTYPE_STRING,
1333610a226SIvan Voras     NULL, 0, sysctl_kern_vm_guest, "A",
13407ce8d9bSIvan Voras     "Virtual machine guest detected? (none|generic|xen)");
1357c45a9c4SAlfred Perlstein 
136df8bae1dSRodney W. Grimes /*
137df8bae1dSRodney W. Grimes  * These have to be allocated somewhere; allocating
138df8bae1dSRodney W. Grimes  * them here forces loader errors if this file is omitted
139df8bae1dSRodney W. Grimes  * (if they've been externed everywhere else; hah!).
140df8bae1dSRodney W. Grimes  */
14128f8db14SBruce Evans struct	buf *swbuf;
1429722d88fSJason Evans 
1430b993ee5SAlan Cox /*
1440b993ee5SAlan Cox  * The elements of this array are ordered based upon the values of the
1450b993ee5SAlan Cox  * corresponding enum VM_GUEST members.
1460b993ee5SAlan Cox  */
14734820bbfSBjoern A. Zeeb static const char *const vm_guest_sysctl_names[] = {
14834820bbfSBjoern A. Zeeb 	"none",
14934820bbfSBjoern A. Zeeb 	"generic",
15034820bbfSBjoern A. Zeeb 	"xen",
15134820bbfSBjoern A. Zeeb 	NULL
15234820bbfSBjoern A. Zeeb };
15334820bbfSBjoern A. Zeeb 
15434820bbfSBjoern A. Zeeb #ifndef XEN
1559bd2cbe4SJung-uk Kim static const char *const vm_bnames[] = {
1569bd2cbe4SJung-uk Kim 	"QEMU",				/* QEMU */
1579bd2cbe4SJung-uk Kim 	"Plex86",			/* Plex86 */
1589bd2cbe4SJung-uk Kim 	"Bochs",			/* Bochs */
159ea235a14SChristian S.J. Peron 	"Xen",				/* Xen */
1609bd2cbe4SJung-uk Kim 	NULL
1619bd2cbe4SJung-uk Kim };
1629bd2cbe4SJung-uk Kim 
1634da059f3SMaxim Sobolev static const char *const vm_pnames[] = {
1647f03c419SMaxim Sobolev 	"VMware Virtual Platform",	/* VMWare VM */
1657f03c419SMaxim Sobolev 	"Virtual Machine",		/* Microsoft VirtualPC */
1667f03c419SMaxim Sobolev 	"VirtualBox",			/* Sun xVM VirtualBox */
1677f03c419SMaxim Sobolev 	"Parallels Virtual Platform",	/* Parallels VM */
1687f03c419SMaxim Sobolev 	NULL
1697f03c419SMaxim Sobolev };
1707f03c419SMaxim Sobolev 
1713610a226SIvan Voras 
1723610a226SIvan Voras /*
1733610a226SIvan Voras  * Detect known Virtual Machine hosts by inspecting the emulated BIOS.
1743610a226SIvan Voras  */
1753dc30911SIvan Voras static enum VM_GUEST
1767f03c419SMaxim Sobolev detect_virtual(void)
1777f03c419SMaxim Sobolev {
1787f03c419SMaxim Sobolev 	char *sysenv;
1797f03c419SMaxim Sobolev 	int i;
1807f03c419SMaxim Sobolev 
1819bd2cbe4SJung-uk Kim 	sysenv = getenv("smbios.bios.vendor");
1829bd2cbe4SJung-uk Kim 	if (sysenv != NULL) {
1839bd2cbe4SJung-uk Kim 		for (i = 0; vm_bnames[i] != NULL; i++)
1849bd2cbe4SJung-uk Kim 			if (strcmp(sysenv, vm_bnames[i]) == 0) {
1859bd2cbe4SJung-uk Kim 				freeenv(sysenv);
1863dc30911SIvan Voras 				return (VM_GUEST_VM);
1879bd2cbe4SJung-uk Kim 			}
1889bd2cbe4SJung-uk Kim 		freeenv(sysenv);
1899bd2cbe4SJung-uk Kim 	}
1907f03c419SMaxim Sobolev 	sysenv = getenv("smbios.system.product");
1917f03c419SMaxim Sobolev 	if (sysenv != NULL) {
1929bd2cbe4SJung-uk Kim 		for (i = 0; vm_pnames[i] != NULL; i++)
1939bd2cbe4SJung-uk Kim 			if (strcmp(sysenv, vm_pnames[i]) == 0) {
1949bd2cbe4SJung-uk Kim 				freeenv(sysenv);
1953dc30911SIvan Voras 				return (VM_GUEST_VM);
1967f03c419SMaxim Sobolev 			}
1979bd2cbe4SJung-uk Kim 		freeenv(sysenv);
1987f03c419SMaxim Sobolev 	}
1993dc30911SIvan Voras 	return (VM_GUEST_NO);
2007f03c419SMaxim Sobolev }
20134820bbfSBjoern A. Zeeb #endif
2027f03c419SMaxim Sobolev 
2039722d88fSJason Evans /*
20466a11b9fSMatthew Dillon  * Boot time overrides that are not scaled against main memory
205ee342e1bSPeter Wemm  */
206ee342e1bSPeter Wemm void
20766a11b9fSMatthew Dillon init_param1(void)
208ee342e1bSPeter Wemm {
2093dc30911SIvan Voras #ifndef XEN
2103dc30911SIvan Voras 	vm_guest = detect_virtual();
2113dc30911SIvan Voras #else
2123dc30911SIvan Voras 	vm_guest = VM_GUEST_XEN;
2133dc30911SIvan Voras #endif
2147f03c419SMaxim Sobolev 	hz = -1;
215ee342e1bSPeter Wemm 	TUNABLE_INT_FETCH("kern.hz", &hz);
2169bd2cbe4SJung-uk Kim 	if (hz == -1)
2173dc30911SIvan Voras 		hz = vm_guest > VM_GUEST_NO ? HZ_VM : HZ;
218ee342e1bSPeter Wemm 	tick = 1000000 / hz;
219ee342e1bSPeter Wemm 
220e1616f3aSMatthew Dillon #ifdef VM_SWZONE_SIZE_MAX
2212f9e4e80SMatthew Dillon 	maxswzone = VM_SWZONE_SIZE_MAX;
222e1616f3aSMatthew Dillon #endif
2235bd65606SJohn Baldwin 	TUNABLE_LONG_FETCH("kern.maxswzone", &maxswzone);
224e1616f3aSMatthew Dillon #ifdef VM_BCACHE_SIZE_MAX
2252f9e4e80SMatthew Dillon 	maxbcache = VM_BCACHE_SIZE_MAX;
226e1616f3aSMatthew Dillon #endif
2275bd65606SJohn Baldwin 	TUNABLE_LONG_FETCH("kern.maxbcache", &maxbcache);
2284053b05bSSergey Kandaurov 	msgbufsize = MSGBUF_SIZE;
2294053b05bSSergey Kandaurov 	TUNABLE_INT_FETCH("kern.msgbufsize", &msgbufsize);
230cbc89bfbSPaul Saab 
231cbc89bfbSPaul Saab 	maxtsiz = MAXTSIZ;
2327419d1e2SDag-Erling Smørgrav 	TUNABLE_ULONG_FETCH("kern.maxtsiz", &maxtsiz);
233cbc89bfbSPaul Saab 	dfldsiz = DFLDSIZ;
2347419d1e2SDag-Erling Smørgrav 	TUNABLE_ULONG_FETCH("kern.dfldsiz", &dfldsiz);
235cbc89bfbSPaul Saab 	maxdsiz = MAXDSIZ;
2367419d1e2SDag-Erling Smørgrav 	TUNABLE_ULONG_FETCH("kern.maxdsiz", &maxdsiz);
237cbc89bfbSPaul Saab 	dflssiz = DFLSSIZ;
2387419d1e2SDag-Erling Smørgrav 	TUNABLE_ULONG_FETCH("kern.dflssiz", &dflssiz);
239cbc89bfbSPaul Saab 	maxssiz = MAXSSIZ;
2407419d1e2SDag-Erling Smørgrav 	TUNABLE_ULONG_FETCH("kern.maxssiz", &maxssiz);
241cbc89bfbSPaul Saab 	sgrowsiz = SGROWSIZ;
2427419d1e2SDag-Erling Smørgrav 	TUNABLE_ULONG_FETCH("kern.sgrowsiz", &sgrowsiz);
243412f9500SBrooks Davis 
244412f9500SBrooks Davis 	/*
245412f9500SBrooks Davis 	 * Let the administrator set {NGROUPS_MAX}, but disallow values
246412f9500SBrooks Davis 	 * less than NGROUPS_MAX which would violate POSIX.1-2008 or
247412f9500SBrooks Davis 	 * greater than INT_MAX-1 which would result in overflow.
248412f9500SBrooks Davis 	 */
249412f9500SBrooks Davis 	ngroups_max = NGROUPS_MAX;
250412f9500SBrooks Davis 	TUNABLE_INT_FETCH("kern.ngroups", &ngroups_max);
251412f9500SBrooks Davis 	if (ngroups_max < NGROUPS_MAX)
252412f9500SBrooks Davis 		ngroups_max = NGROUPS_MAX;
253ee342e1bSPeter Wemm }
25466a11b9fSMatthew Dillon 
25566a11b9fSMatthew Dillon /*
25666a11b9fSMatthew Dillon  * Boot time overrides that are scaled against main memory
25766a11b9fSMatthew Dillon  */
25866a11b9fSMatthew Dillon void
259447b3772SPeter Wemm init_param2(long physpages)
26066a11b9fSMatthew Dillon {
26166a11b9fSMatthew Dillon 
26266a11b9fSMatthew Dillon 	/* Base parameters */
2630b94a0e9SMatthew Dillon 	maxusers = MAXUSERS;
2640b94a0e9SMatthew Dillon 	TUNABLE_INT_FETCH("kern.maxusers", &maxusers);
2650b94a0e9SMatthew Dillon 	if (maxusers == 0) {
2664fbd563eSMatthew Dillon 		maxusers = physpages / (2 * 1024 * 1024 / PAGE_SIZE);
26766a11b9fSMatthew Dillon 		if (maxusers < 32)
26866a11b9fSMatthew Dillon 			maxusers = 32;
2694fbd563eSMatthew Dillon 		if (maxusers > 384)
2704fbd563eSMatthew Dillon 			maxusers = 384;
27166a11b9fSMatthew Dillon 	}
27266a11b9fSMatthew Dillon 
27366a11b9fSMatthew Dillon 	/*
27466a11b9fSMatthew Dillon 	 * The following can be overridden after boot via sysctl.  Note:
27566a11b9fSMatthew Dillon 	 * unless overriden, these macros are ultimately based on maxusers.
27666a11b9fSMatthew Dillon 	 */
27766a11b9fSMatthew Dillon 	maxproc = NPROC;
27866a11b9fSMatthew Dillon 	TUNABLE_INT_FETCH("kern.maxproc", &maxproc);
27977a7d074SMike Silbersack 	/*
28077a7d074SMike Silbersack 	 * Limit maxproc so that kmap entries cannot be exhausted by
28177a7d074SMike Silbersack 	 * processes.
28277a7d074SMike Silbersack 	 */
28377a7d074SMike Silbersack 	if (maxproc > (physpages / 12))
28477a7d074SMike Silbersack 		maxproc = physpages / 12;
28566a11b9fSMatthew Dillon 	maxfiles = MAXFILES;
28666a11b9fSMatthew Dillon 	TUNABLE_INT_FETCH("kern.maxfiles", &maxfiles);
287ebacce5eSMike Silbersack 	maxprocperuid = (maxproc * 9) / 10;
288ebacce5eSMike Silbersack 	maxfilesperproc = (maxfiles * 9) / 10;
28966a11b9fSMatthew Dillon 
29066a11b9fSMatthew Dillon 	/*
291347194c1SMike Silbersack 	 * Cannot be changed after boot.
292347194c1SMike Silbersack 	 */
293347194c1SMike Silbersack 	nbuf = NBUF;
294347194c1SMike Silbersack 	TUNABLE_INT_FETCH("kern.nbuf", &nbuf);
295347194c1SMike Silbersack 
296347194c1SMike Silbersack 	ncallout = 16 + maxproc + maxfiles;
297347194c1SMike Silbersack 	TUNABLE_INT_FETCH("kern.ncallout", &ncallout);
298347194c1SMike Silbersack 
299347194c1SMike Silbersack 	/*
300*e9a3f785SAlan Cox 	 * The default for maxpipekva is min(1/64 of the kernel address space,
301*e9a3f785SAlan Cox 	 * max(1/64 of main memory, 512KB)).  See sys_pipe.c for more details.
302347194c1SMike Silbersack 	 */
303*e9a3f785SAlan Cox 	maxpipekva = (physpages / 64) * PAGE_SIZE;
304289016f2SMike Silbersack 	if (maxpipekva < 512 * 1024)
305289016f2SMike Silbersack 		maxpipekva = 512 * 1024;
306*e9a3f785SAlan Cox 	if (maxpipekva > (VM_MAX_KERNEL_ADDRESS - VM_MIN_KERNEL_ADDRESS) / 64)
307*e9a3f785SAlan Cox 		maxpipekva = (VM_MAX_KERNEL_ADDRESS - VM_MIN_KERNEL_ADDRESS) /
308*e9a3f785SAlan Cox 		    64;
30964ecd139SJohn Baldwin 	TUNABLE_LONG_FETCH("kern.ipc.maxpipekva", &maxpipekva);
31066a11b9fSMatthew Dillon }
3113610a226SIvan Voras 
3123610a226SIvan Voras /*
3133610a226SIvan Voras  * Sysctl stringiying handler for kern.vm_guest.
3143610a226SIvan Voras  */
3153610a226SIvan Voras static int
3163610a226SIvan Voras sysctl_kern_vm_guest(SYSCTL_HANDLER_ARGS)
3173610a226SIvan Voras {
3183610a226SIvan Voras 	return (SYSCTL_OUT(req, vm_guest_sysctl_names[vm_guest],
3193610a226SIvan Voras 	    strlen(vm_guest_sysctl_names[vm_guest])));
3203610a226SIvan Voras }
321