xref: /freebsd/sys/vm/vm_param.h (revision d73ce4c6986e10c39ad4dfc4f2261e3ad5f17ead)
160727d8bSWarner Losh /*-
2df8bae1dSRodney W. Grimes  * Copyright (c) 1991, 1993
3df8bae1dSRodney W. Grimes  *	The Regents of the University of California.  All rights reserved.
4df8bae1dSRodney W. Grimes  *
5df8bae1dSRodney W. Grimes  * This code is derived from software contributed to Berkeley by
6df8bae1dSRodney W. Grimes  * The Mach Operating System project at Carnegie-Mellon University.
7df8bae1dSRodney W. Grimes  *
8df8bae1dSRodney W. Grimes  * Redistribution and use in source and binary forms, with or without
9df8bae1dSRodney W. Grimes  * modification, are permitted provided that the following conditions
10df8bae1dSRodney W. Grimes  * are met:
11df8bae1dSRodney W. Grimes  * 1. Redistributions of source code must retain the above copyright
12df8bae1dSRodney W. Grimes  *    notice, this list of conditions and the following disclaimer.
13df8bae1dSRodney W. Grimes  * 2. Redistributions in binary form must reproduce the above copyright
14df8bae1dSRodney W. Grimes  *    notice, this list of conditions and the following disclaimer in the
15df8bae1dSRodney W. Grimes  *    documentation and/or other materials provided with the distribution.
16df8bae1dSRodney W. Grimes  * 4. Neither the name of the University nor the names of its contributors
17df8bae1dSRodney W. Grimes  *    may be used to endorse or promote products derived from this software
18df8bae1dSRodney W. Grimes  *    without specific prior written permission.
19df8bae1dSRodney W. Grimes  *
20df8bae1dSRodney W. Grimes  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
21df8bae1dSRodney W. Grimes  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22df8bae1dSRodney W. Grimes  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23df8bae1dSRodney W. Grimes  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
24df8bae1dSRodney W. Grimes  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25df8bae1dSRodney W. Grimes  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26df8bae1dSRodney W. Grimes  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27df8bae1dSRodney W. Grimes  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28df8bae1dSRodney W. Grimes  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29df8bae1dSRodney W. Grimes  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30df8bae1dSRodney W. Grimes  * SUCH DAMAGE.
31df8bae1dSRodney W. Grimes  *
323c4dd356SDavid Greenman  *	from: @(#)vm_param.h	8.1 (Berkeley) 6/11/93
33df8bae1dSRodney W. Grimes  *
34df8bae1dSRodney W. Grimes  *
35df8bae1dSRodney W. Grimes  * Copyright (c) 1987, 1990 Carnegie-Mellon University.
36df8bae1dSRodney W. Grimes  * All rights reserved.
37df8bae1dSRodney W. Grimes  *
38df8bae1dSRodney W. Grimes  * Authors: Avadis Tevanian, Jr., Michael Wayne Young
39df8bae1dSRodney W. Grimes  *
40df8bae1dSRodney W. Grimes  * Permission to use, copy, modify and distribute this software and
41df8bae1dSRodney W. Grimes  * its documentation is hereby granted, provided that both the copyright
42df8bae1dSRodney W. Grimes  * notice and this permission notice appear in all copies of the
43df8bae1dSRodney W. Grimes  * software, derivative works or modified versions, and any portions
44df8bae1dSRodney W. Grimes  * thereof, and that both notices appear in supporting documentation.
45df8bae1dSRodney W. Grimes  *
46df8bae1dSRodney W. Grimes  * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
47df8bae1dSRodney W. Grimes  * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
48df8bae1dSRodney W. Grimes  * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
49df8bae1dSRodney W. Grimes  *
50df8bae1dSRodney W. Grimes  * Carnegie Mellon requests users of this software to return to
51df8bae1dSRodney W. Grimes  *
52df8bae1dSRodney W. Grimes  *  Software Distribution Coordinator  or  Software.Distribution@CS.CMU.EDU
53df8bae1dSRodney W. Grimes  *  School of Computer Science
54df8bae1dSRodney W. Grimes  *  Carnegie Mellon University
55df8bae1dSRodney W. Grimes  *  Pittsburgh PA 15213-3890
56df8bae1dSRodney W. Grimes  *
57df8bae1dSRodney W. Grimes  * any improvements or extensions that they make and grant Carnegie the
58df8bae1dSRodney W. Grimes  * rights to redistribute these changes.
593c4dd356SDavid Greenman  *
60c3aac50fSPeter Wemm  * $FreeBSD$
61df8bae1dSRodney W. Grimes  */
62df8bae1dSRodney W. Grimes 
63df8bae1dSRodney W. Grimes /*
64df8bae1dSRodney W. Grimes  *	Machine independent virtual memory parameters.
65df8bae1dSRodney W. Grimes  */
66df8bae1dSRodney W. Grimes 
67df8bae1dSRodney W. Grimes #ifndef	_VM_PARAM_
68df8bae1dSRodney W. Grimes #define	_VM_PARAM_
69df8bae1dSRodney W. Grimes 
70df8bae1dSRodney W. Grimes #include <machine/vmparam.h>
71df8bae1dSRodney W. Grimes 
72df8bae1dSRodney W. Grimes /*
73df8bae1dSRodney W. Grimes  * CTL_VM identifiers
74df8bae1dSRodney W. Grimes  */
75f7550ecfSMatthew Dillon #define	VM_TOTAL		1	/* struct vmtotal */
76c4aa0a2eSDavid E. O'Brien #define	VM_METER                VM_TOTAL/* deprecated, use VM_TOTAL */
77df8bae1dSRodney W. Grimes #define	VM_LOADAVG	 	2	/* struct loadavg */
7844f1c916SBryan Drewery #define VM_V_FREE_MIN		3	/* vm_cnt.v_free_min */
7944f1c916SBryan Drewery #define VM_V_FREE_TARGET	4	/* vm_cnt.v_free_target */
8044f1c916SBryan Drewery #define VM_V_FREE_RESERVED	5	/* vm_cnt.v_free_reserved */
8144f1c916SBryan Drewery #define VM_V_INACTIVE_TARGET	6	/* vm_cnt.v_inactive_target */
82*d73ce4c6SMark Johnston #define	VM_OBSOLETE_7		7	/* unused, formerly v_cache_min */
83*d73ce4c6SMark Johnston #define	VM_OBSOLETE_8		8	/* unused, formerly v_cache_max */
8444f1c916SBryan Drewery #define VM_V_PAGEOUT_FREE_MIN	9	/* vm_cnt.v_pageout_free_min */
8523b5c8feSAndrey Zonov #define	VM_OBSOLETE_10		10	/* pageout algorithm */
8623b5c8feSAndrey Zonov #define VM_SWAPPING_ENABLED	11	/* swapping enabled */
8723b5c8feSAndrey Zonov #define	VM_MAXID		12	/* number of valid vm ids */
88df8bae1dSRodney W. Grimes 
89df8bae1dSRodney W. Grimes /*
905c5c8fa8SThomas Moestl  * Structure for swap device statistics
915c5c8fa8SThomas Moestl  */
925c5c8fa8SThomas Moestl #define XSWDEV_VERSION	1
935c5c8fa8SThomas Moestl struct xswdev {
945c5c8fa8SThomas Moestl 	u_int	xsw_version;
95f3732fd1SPoul-Henning Kamp 	dev_t	xsw_dev;
965c5c8fa8SThomas Moestl 	int	xsw_flags;
975c5c8fa8SThomas Moestl 	int	xsw_nblks;
985c5c8fa8SThomas Moestl 	int     xsw_used;
995c5c8fa8SThomas Moestl };
1005c5c8fa8SThomas Moestl 
1015c5c8fa8SThomas Moestl /*
102df8bae1dSRodney W. Grimes  *	Return values from the VM routines.
103df8bae1dSRodney W. Grimes  */
104df8bae1dSRodney W. Grimes #define	KERN_SUCCESS		0
105df8bae1dSRodney W. Grimes #define	KERN_INVALID_ADDRESS	1
106df8bae1dSRodney W. Grimes #define	KERN_PROTECTION_FAILURE	2
107df8bae1dSRodney W. Grimes #define	KERN_NO_SPACE		3
108df8bae1dSRodney W. Grimes #define	KERN_INVALID_ARGUMENT	4
109df8bae1dSRodney W. Grimes #define	KERN_FAILURE		5
110df8bae1dSRodney W. Grimes #define	KERN_RESOURCE_SHORTAGE	6
111df8bae1dSRodney W. Grimes #define	KERN_NOT_RECEIVER	7
112df8bae1dSRodney W. Grimes #define	KERN_NO_ACCESS		8
113df8bae1dSRodney W. Grimes 
1142965a453SKip Macy #ifndef PA_LOCK_COUNT
1152965a453SKip Macy #ifdef SMP
1162965a453SKip Macy #define	PA_LOCK_COUNT	32
1172965a453SKip Macy #else
1182965a453SKip Macy #define PA_LOCK_COUNT	1
1192965a453SKip Macy #endif	/* !SMP */
1202965a453SKip Macy #endif	/* !PA_LOCK_COUNT */
1212965a453SKip Macy 
122df8bae1dSRodney W. Grimes #ifndef ASSEMBLER
123c4473420SPeter Wemm #ifdef _KERNEL
124df8bae1dSRodney W. Grimes #define num_pages(x) \
125df8bae1dSRodney W. Grimes 	((vm_offset_t)((((vm_offset_t)(x)) + PAGE_MASK) >> PAGE_SHIFT))
1267419d1e2SDag-Erling Smørgrav extern	unsigned long maxtsiz;
1277419d1e2SDag-Erling Smørgrav extern	unsigned long dfldsiz;
1287419d1e2SDag-Erling Smørgrav extern	unsigned long maxdsiz;
1297419d1e2SDag-Erling Smørgrav extern	unsigned long dflssiz;
1307419d1e2SDag-Erling Smørgrav extern	unsigned long maxssiz;
1317419d1e2SDag-Erling Smørgrav extern	unsigned long sgrowsiz;
132c4473420SPeter Wemm #endif				/* _KERNEL */
133df8bae1dSRodney W. Grimes #endif				/* ASSEMBLER */
134df8bae1dSRodney W. Grimes #endif				/* _VM_PARAM_ */
135