xref: /freebsd/sys/vm/vm_param.h (revision 7419d1e25f7f19faacb09fa604b8866cd9436c43)
1df8bae1dSRodney W. Grimes /*
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 */
780d94caffSDavid Greenman #define VM_V_FREE_MIN		3	/* cnt.v_free_min */
790d94caffSDavid Greenman #define VM_V_FREE_TARGET	4	/* cnt.v_free_target */
800d94caffSDavid Greenman #define VM_V_FREE_RESERVED	5	/* cnt.v_free_reserved */
810d94caffSDavid Greenman #define VM_V_INACTIVE_TARGET	6	/* cnt.v_inactive_target */
820d94caffSDavid Greenman #define VM_V_CACHE_MIN		7	/* cnt.v_cache_max */
830d94caffSDavid Greenman #define VM_V_CACHE_MAX		8	/* cnt.v_cache_min */
840d94caffSDavid Greenman #define VM_V_PAGEOUT_FREE_MIN	9	/* cnt.v_pageout_free_min */
8538efa82bSJohn Dyson #define	VM_PAGEOUT_ALGORITHM	10	/* pageout algorithm */
8638efa82bSJohn Dyson #define VM_SWAPPING_ENABLED	11	/* swapping enabled */
8738efa82bSJohn Dyson #define	VM_MAXID		12	/* number of valid vm ids */
88df8bae1dSRodney W. Grimes 
89df8bae1dSRodney W. Grimes #define CTL_VM_NAMES { \
90df8bae1dSRodney W. Grimes 	{ 0, 0 }, \
91f7550ecfSMatthew Dillon 	{ "vmtotal", CTLTYPE_STRUCT }, \
92df8bae1dSRodney W. Grimes 	{ "loadavg", CTLTYPE_STRUCT }, \
930d94caffSDavid Greenman 	{ "v_free_min", CTLTYPE_INT }, \
940d94caffSDavid Greenman 	{ "v_free_target", CTLTYPE_INT }, \
950d94caffSDavid Greenman 	{ "v_free_reserved", CTLTYPE_INT }, \
960d94caffSDavid Greenman 	{ "v_inactive_target", CTLTYPE_INT }, \
970d94caffSDavid Greenman 	{ "v_cache_min", CTLTYPE_INT }, \
980d94caffSDavid Greenman 	{ "v_cache_max", CTLTYPE_INT }, \
990d94caffSDavid Greenman 	{ "v_pageout_free_min", CTLTYPE_INT}, \
10038efa82bSJohn Dyson 	{ "pageout_algorithm", CTLTYPE_INT}, \
10138efa82bSJohn Dyson 	{ "swapping_enabled", CTLTYPE_INT},\
102df8bae1dSRodney W. Grimes }
103df8bae1dSRodney W. Grimes 
104df8bae1dSRodney W. Grimes /*
1055c5c8fa8SThomas Moestl  * Structure for swap device statistics
1065c5c8fa8SThomas Moestl  */
1075c5c8fa8SThomas Moestl #define XSWDEV_VERSION	1
1085c5c8fa8SThomas Moestl struct xswdev {
1095c5c8fa8SThomas Moestl 	u_int	xsw_version;
110f3732fd1SPoul-Henning Kamp 	dev_t	xsw_dev;
1115c5c8fa8SThomas Moestl 	int	xsw_flags;
1125c5c8fa8SThomas Moestl 	int	xsw_nblks;
1135c5c8fa8SThomas Moestl 	int     xsw_used;
1145c5c8fa8SThomas Moestl };
1155c5c8fa8SThomas Moestl 
1165c5c8fa8SThomas Moestl /*
117df8bae1dSRodney W. Grimes  *	Return values from the VM routines.
118df8bae1dSRodney W. Grimes  */
119df8bae1dSRodney W. Grimes #define	KERN_SUCCESS		0
120df8bae1dSRodney W. Grimes #define	KERN_INVALID_ADDRESS	1
121df8bae1dSRodney W. Grimes #define	KERN_PROTECTION_FAILURE	2
122df8bae1dSRodney W. Grimes #define	KERN_NO_SPACE		3
123df8bae1dSRodney W. Grimes #define	KERN_INVALID_ARGUMENT	4
124df8bae1dSRodney W. Grimes #define	KERN_FAILURE		5
125df8bae1dSRodney W. Grimes #define	KERN_RESOURCE_SHORTAGE	6
126df8bae1dSRodney W. Grimes #define	KERN_NOT_RECEIVER	7
127df8bae1dSRodney W. Grimes #define	KERN_NO_ACCESS		8
128df8bae1dSRodney W. Grimes 
129df8bae1dSRodney W. Grimes #ifndef ASSEMBLER
130c4473420SPeter Wemm #ifdef _KERNEL
131df8bae1dSRodney W. Grimes #define num_pages(x) \
132df8bae1dSRodney W. Grimes 	((vm_offset_t)((((vm_offset_t)(x)) + PAGE_MASK) >> PAGE_SHIFT))
1337419d1e2SDag-Erling Smørgrav extern	unsigned long maxtsiz;
1347419d1e2SDag-Erling Smørgrav extern	unsigned long dfldsiz;
1357419d1e2SDag-Erling Smørgrav extern	unsigned long maxdsiz;
1367419d1e2SDag-Erling Smørgrav extern	unsigned long dflssiz;
1377419d1e2SDag-Erling Smørgrav extern	unsigned long maxssiz;
1387419d1e2SDag-Erling Smørgrav extern	unsigned long sgrowsiz;
139c4473420SPeter Wemm #endif				/* _KERNEL */
140df8bae1dSRodney W. Grimes #endif				/* ASSEMBLER */
141df8bae1dSRodney W. Grimes #endif				/* _VM_PARAM_ */
142