xref: /freebsd/sys/vm/vm_pageout.h (revision 54a3a1142189f60edfbbdfb0e1f4085e2d30c115)
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_pageout.h	8.2 (Berkeley) 1/12/94
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  * Author: Avadis Tevanian, Jr.
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 
653301cc3cSPaul Richards #ifndef _VM_VM_PAGEOUT_H_
663301cc3cSPaul Richards #define _VM_VM_PAGEOUT_H_
673301cc3cSPaul Richards 
68cd84455fSKonstantin Belousov #ifdef _KERNEL
69cd84455fSKonstantin Belousov 
70df8bae1dSRodney W. Grimes /*
71df8bae1dSRodney W. Grimes  *	Header file for pageout daemon.
72df8bae1dSRodney W. Grimes  */
73df8bae1dSRodney W. Grimes 
74df8bae1dSRodney W. Grimes /*
75df8bae1dSRodney W. Grimes  *	Exported data structures.
76df8bae1dSRodney W. Grimes  */
77df8bae1dSRodney W. Grimes 
78*54a3a114SMark Johnston extern u_long vm_page_max_user_wired;
79f92039a1SAlan Cox extern int vm_pageout_page_count;
80df8bae1dSRodney W. Grimes 
812025d69bSKonstantin Belousov #define	VM_OOM_MEM	1
822025d69bSKonstantin Belousov #define	VM_OOM_SWAPZ	2
832025d69bSKonstantin Belousov 
84ceb0cf87SJohn Dyson /*
859b43bc27SAndriy Gapon  * vm_lowmem flags.
869b43bc27SAndriy Gapon  */
879b43bc27SAndriy Gapon #define	VM_LOW_KMEM	0x01
889b43bc27SAndriy Gapon #define	VM_LOW_PAGES	0x02
899b43bc27SAndriy Gapon 
909b43bc27SAndriy Gapon /*
91df8bae1dSRodney W. Grimes  *	Exported routines.
92df8bae1dSRodney W. Grimes  */
93df8bae1dSRodney W. Grimes 
94df8bae1dSRodney W. Grimes /*
95df8bae1dSRodney W. Grimes  *	Signal pageout-daemon and wait for it.
96df8bae1dSRodney W. Grimes  */
97df8bae1dSRodney W. Grimes 
982c0f13aaSKonstantin Belousov void vm_wait(vm_object_t obj);
9923984ce5SMark Johnston void vm_waitpfault(struct domainset *);
100e2068d0bSJeff Roberson void vm_wait_domain(int domain);
101e2068d0bSJeff Roberson void vm_wait_min(void);
102e2068d0bSJeff Roberson void vm_wait_severe(void);
10326f9a767SRodney W. Grimes 
104126d6082SKonstantin Belousov int vm_pageout_flush(vm_page_t *, int, int, int, int *, boolean_t *);
1052025d69bSKonstantin Belousov void vm_pageout_oom(int shortage);
106ac04195bSKonstantin Belousov 
107ac04195bSKonstantin Belousov void vm_swapout_run(void);
108ac04195bSKonstantin Belousov void vm_swapout_run_idle(void);
109c3f4f28cSBen Widawsky 
110cd84455fSKonstantin Belousov #endif /* _KERNEL */
111a1287949SEivind Eklund #endif	/* _VM_VM_PAGEOUT_H_ */
112