xref: /freebsd/sys/vm/vm_pageout.h (revision fbbd9655e5107c68e4e0146ff22b73d7350475bc)
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.
16*fbbd9655SWarner Losh  * 3. 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_pageout.h	8.2 (Berkeley) 1/12/94
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  * Author: Avadis Tevanian, Jr.
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 
633301cc3cSPaul Richards #ifndef _VM_VM_PAGEOUT_H_
643301cc3cSPaul Richards #define _VM_VM_PAGEOUT_H_
653301cc3cSPaul Richards 
66df8bae1dSRodney W. Grimes /*
67df8bae1dSRodney W. Grimes  *	Header file for pageout daemon.
68df8bae1dSRodney W. Grimes  */
69df8bae1dSRodney W. Grimes 
70df8bae1dSRodney W. Grimes /*
71df8bae1dSRodney W. Grimes  *	Exported data structures.
72df8bae1dSRodney W. Grimes  */
73df8bae1dSRodney W. Grimes 
74b5e8ce9fSBruce Evans extern int vm_page_max_wired;
752d8acc0fSJohn Dyson extern int vm_pageout_deficit;
76f92039a1SAlan Cox extern int vm_pageout_page_count;
7756ce0690SAlan Cox extern bool vm_pageout_wanted;
7856ce0690SAlan Cox extern bool vm_pages_needed;
79df8bae1dSRodney W. Grimes 
80df8bae1dSRodney W. Grimes /*
81ceb0cf87SJohn Dyson  * Swap out requests
82ceb0cf87SJohn Dyson  */
83ceb0cf87SJohn Dyson #define VM_SWAP_NORMAL 1
84ceb0cf87SJohn Dyson #define VM_SWAP_IDLE 2
85ceb0cf87SJohn Dyson 
862025d69bSKonstantin Belousov #define	VM_OOM_MEM	1
872025d69bSKonstantin Belousov #define	VM_OOM_SWAPZ	2
882025d69bSKonstantin Belousov 
89ceb0cf87SJohn Dyson /*
909b43bc27SAndriy Gapon  * vm_lowmem flags.
919b43bc27SAndriy Gapon  */
929b43bc27SAndriy Gapon #define	VM_LOW_KMEM	0x01
939b43bc27SAndriy Gapon #define	VM_LOW_PAGES	0x02
949b43bc27SAndriy Gapon 
959b43bc27SAndriy Gapon /*
96df8bae1dSRodney W. Grimes  *	Exported routines.
97df8bae1dSRodney W. Grimes  */
98df8bae1dSRodney W. Grimes 
99df8bae1dSRodney W. Grimes /*
100df8bae1dSRodney W. Grimes  *	Signal pageout-daemon and wait for it.
101df8bae1dSRodney W. Grimes  */
102df8bae1dSRodney W. Grimes 
10311caded3SAlfred Perlstein extern void pagedaemon_wakeup(void);
10426f9a767SRodney W. Grimes #define VM_WAIT vm_wait()
105ef6020d1SMike Silbersack #define VM_WAITPFAULT vm_waitpfault()
10611caded3SAlfred Perlstein extern void vm_wait(void);
10711caded3SAlfred Perlstein extern void vm_waitpfault(void);
10826f9a767SRodney W. Grimes 
109c4473420SPeter Wemm #ifdef _KERNEL
110126d6082SKonstantin Belousov int vm_pageout_flush(vm_page_t *, int, int, int, int *, boolean_t *);
1112025d69bSKonstantin Belousov void vm_pageout_oom(int shortage);
112df8bae1dSRodney W. Grimes #endif
113a1287949SEivind Eklund #endif	/* _VM_VM_PAGEOUT_H_ */
114