xref: /freebsd/sys/vm/vm_param.h (revision fcb0475833675e65b2bb1ce3464bccef97c693f7)
160727d8bSWarner Losh /*-
2796df753SPedro F. Giffuni  * SPDX-License-Identifier: (BSD-3-Clause AND MIT-CMU)
351369649SPedro F. Giffuni  *
4df8bae1dSRodney W. Grimes  * Copyright (c) 1991, 1993
5df8bae1dSRodney W. Grimes  *	The Regents of the University of California.  All rights reserved.
6df8bae1dSRodney W. Grimes  *
7df8bae1dSRodney W. Grimes  * This code is derived from software contributed to Berkeley by
8df8bae1dSRodney W. Grimes  * The Mach Operating System project at Carnegie-Mellon University.
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.
18fbbd9655SWarner Losh  * 3. 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  *
343c4dd356SDavid Greenman  *	from: @(#)vm_param.h	8.1 (Berkeley) 6/11/93
35df8bae1dSRodney W. Grimes  *
36df8bae1dSRodney W. Grimes  *
37df8bae1dSRodney W. Grimes  * Copyright (c) 1987, 1990 Carnegie-Mellon University.
38df8bae1dSRodney W. Grimes  * All rights reserved.
39df8bae1dSRodney W. Grimes  *
40df8bae1dSRodney W. Grimes  * Authors: Avadis Tevanian, Jr., Michael Wayne Young
41df8bae1dSRodney W. Grimes  *
42df8bae1dSRodney W. Grimes  * Permission to use, copy, modify and distribute this software and
43df8bae1dSRodney W. Grimes  * its documentation is hereby granted, provided that both the copyright
44df8bae1dSRodney W. Grimes  * notice and this permission notice appear in all copies of the
45df8bae1dSRodney W. Grimes  * software, derivative works or modified versions, and any portions
46df8bae1dSRodney W. Grimes  * thereof, and that both notices appear in supporting documentation.
47df8bae1dSRodney W. Grimes  *
48df8bae1dSRodney W. Grimes  * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
49df8bae1dSRodney W. Grimes  * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
50df8bae1dSRodney W. Grimes  * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
51df8bae1dSRodney W. Grimes  *
52df8bae1dSRodney W. Grimes  * Carnegie Mellon requests users of this software to return to
53df8bae1dSRodney W. Grimes  *
54df8bae1dSRodney W. Grimes  *  Software Distribution Coordinator  or  Software.Distribution@CS.CMU.EDU
55df8bae1dSRodney W. Grimes  *  School of Computer Science
56df8bae1dSRodney W. Grimes  *  Carnegie Mellon University
57df8bae1dSRodney W. Grimes  *  Pittsburgh PA 15213-3890
58df8bae1dSRodney W. Grimes  *
59df8bae1dSRodney W. Grimes  * any improvements or extensions that they make and grant Carnegie the
60df8bae1dSRodney W. Grimes  * rights to redistribute these changes.
613c4dd356SDavid Greenman  *
62c3aac50fSPeter Wemm  * $FreeBSD$
63df8bae1dSRodney W. Grimes  */
64df8bae1dSRodney W. Grimes 
65df8bae1dSRodney W. Grimes /*
66df8bae1dSRodney W. Grimes  *	Machine independent virtual memory parameters.
67df8bae1dSRodney W. Grimes  */
68df8bae1dSRodney W. Grimes 
69df8bae1dSRodney W. Grimes #ifndef	_VM_PARAM_
70df8bae1dSRodney W. Grimes #define	_VM_PARAM_
71df8bae1dSRodney W. Grimes 
72df8bae1dSRodney W. Grimes #include <machine/vmparam.h>
73df8bae1dSRodney W. Grimes 
74df8bae1dSRodney W. Grimes /*
75df8bae1dSRodney W. Grimes  * CTL_VM identifiers
76df8bae1dSRodney W. Grimes  */
77f7550ecfSMatthew Dillon #define	VM_TOTAL		1	/* struct vmtotal */
78c4aa0a2eSDavid E. O'Brien #define	VM_METER                VM_TOTAL/* deprecated, use VM_TOTAL */
79df8bae1dSRodney W. Grimes #define	VM_LOADAVG	 	2	/* struct loadavg */
8044f1c916SBryan Drewery #define VM_V_FREE_MIN		3	/* vm_cnt.v_free_min */
8144f1c916SBryan Drewery #define VM_V_FREE_TARGET	4	/* vm_cnt.v_free_target */
8244f1c916SBryan Drewery #define VM_V_FREE_RESERVED	5	/* vm_cnt.v_free_reserved */
8344f1c916SBryan Drewery #define VM_V_INACTIVE_TARGET	6	/* vm_cnt.v_inactive_target */
84d73ce4c6SMark Johnston #define	VM_OBSOLETE_7		7	/* unused, formerly v_cache_min */
85d73ce4c6SMark Johnston #define	VM_OBSOLETE_8		8	/* unused, formerly v_cache_max */
8644f1c916SBryan Drewery #define VM_V_PAGEOUT_FREE_MIN	9	/* vm_cnt.v_pageout_free_min */
8723b5c8feSAndrey Zonov #define	VM_OBSOLETE_10		10	/* pageout algorithm */
8823b5c8feSAndrey Zonov #define VM_SWAPPING_ENABLED	11	/* swapping enabled */
89be7d4ac5SEdward Tomasz Napierala #define VM_OVERCOMMIT		12	/* vm.overcommit */
90be7d4ac5SEdward Tomasz Napierala #define	VM_MAXID		13	/* number of valid vm ids */
91df8bae1dSRodney W. Grimes 
92df8bae1dSRodney W. Grimes /*
935c5c8fa8SThomas Moestl  * Structure for swap device statistics
945c5c8fa8SThomas Moestl  */
9569921123SKonstantin Belousov #define XSWDEV_VERSION	2
965c5c8fa8SThomas Moestl struct xswdev {
975c5c8fa8SThomas Moestl 	u_int	xsw_version;
98f3732fd1SPoul-Henning Kamp 	dev_t	xsw_dev;
995c5c8fa8SThomas Moestl 	int	xsw_flags;
1005c5c8fa8SThomas Moestl 	int	xsw_nblks;
1015c5c8fa8SThomas Moestl 	int     xsw_used;
1025c5c8fa8SThomas Moestl };
1035c5c8fa8SThomas Moestl 
1045c5c8fa8SThomas Moestl /*
105df8bae1dSRodney W. Grimes  *	Return values from the VM routines.
106df8bae1dSRodney W. Grimes  */
107df8bae1dSRodney W. Grimes #define	KERN_SUCCESS		0
108df8bae1dSRodney W. Grimes #define	KERN_INVALID_ADDRESS	1
109df8bae1dSRodney W. Grimes #define	KERN_PROTECTION_FAILURE	2
110df8bae1dSRodney W. Grimes #define	KERN_NO_SPACE		3
111df8bae1dSRodney W. Grimes #define	KERN_INVALID_ARGUMENT	4
112df8bae1dSRodney W. Grimes #define	KERN_FAILURE		5
113df8bae1dSRodney W. Grimes #define	KERN_RESOURCE_SHORTAGE	6
114df8bae1dSRodney W. Grimes #define	KERN_NOT_RECEIVER	7
115df8bae1dSRodney W. Grimes #define	KERN_NO_ACCESS		8
116df08823dSKonstantin Belousov #define	KERN_OUT_OF_BOUNDS	9
117*fcb04758SJeff Roberson #define	KERN_RESTART		10
118df8bae1dSRodney W. Grimes 
1192965a453SKip Macy #ifndef PA_LOCK_COUNT
1202965a453SKip Macy #ifdef SMP
1212965a453SKip Macy #define	PA_LOCK_COUNT	32
1222965a453SKip Macy #else
1232965a453SKip Macy #define PA_LOCK_COUNT	1
1242965a453SKip Macy #endif	/* !SMP */
1252965a453SKip Macy #endif	/* !PA_LOCK_COUNT */
1262965a453SKip Macy 
1270b26119bSJeff Roberson #ifndef KSTACK_MAX_PAGES
1280b26119bSJeff Roberson #define KSTACK_MAX_PAGES 32
1290b26119bSJeff Roberson #endif
1300b26119bSJeff Roberson 
13121943937SJeff Roberson #ifndef	PHYS_AVAIL_ENTRIES
13221943937SJeff Roberson #define PHYS_AVAIL_ENTRIES      (VM_PHYSSEG_MAX * 2)
13321943937SJeff Roberson #endif
13421943937SJeff Roberson #define PHYS_AVAIL_COUNT        (PHYS_AVAIL_ENTRIES + 2)
13521943937SJeff Roberson 
136df8bae1dSRodney W. Grimes #ifndef ASSEMBLER
137c4473420SPeter Wemm #ifdef _KERNEL
138df8bae1dSRodney W. Grimes #define num_pages(x) \
139df8bae1dSRodney W. Grimes 	((vm_offset_t)((((vm_offset_t)(x)) + PAGE_MASK) >> PAGE_SHIFT))
1407419d1e2SDag-Erling Smørgrav extern	unsigned long maxtsiz;
1417419d1e2SDag-Erling Smørgrav extern	unsigned long dfldsiz;
1427419d1e2SDag-Erling Smørgrav extern	unsigned long maxdsiz;
1437419d1e2SDag-Erling Smørgrav extern	unsigned long dflssiz;
1447419d1e2SDag-Erling Smørgrav extern	unsigned long maxssiz;
1457419d1e2SDag-Erling Smørgrav extern	unsigned long sgrowsiz;
146c4473420SPeter Wemm #endif				/* _KERNEL */
147df8bae1dSRodney W. Grimes #endif				/* ASSEMBLER */
148df8bae1dSRodney W. Grimes #endif				/* _VM_PARAM_ */
149