xref: /freebsd/sys/vm/vm_pageout.h (revision 13a1129d700cee67107c1a146f9c6e8bea372644)
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  *
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.
59df8bae1dSRodney W. Grimes  */
60df8bae1dSRodney W. Grimes 
613301cc3cSPaul Richards #ifndef _VM_VM_PAGEOUT_H_
623301cc3cSPaul Richards #define _VM_VM_PAGEOUT_H_
633301cc3cSPaul Richards 
64cd84455fSKonstantin Belousov #ifdef _KERNEL
65cd84455fSKonstantin Belousov 
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 
7454a3a114SMark Johnston extern u_long vm_page_max_user_wired;
75f92039a1SAlan Cox extern int vm_pageout_page_count;
76df8bae1dSRodney W. Grimes 
772025d69bSKonstantin Belousov #define	VM_OOM_MEM	1
78245139c6SKonstantin Belousov #define	VM_OOM_MEM_PF	2
79245139c6SKonstantin Belousov #define	VM_OOM_SWAPZ	3
802025d69bSKonstantin Belousov 
81ceb0cf87SJohn Dyson /*
829b43bc27SAndriy Gapon  * vm_lowmem flags.
839b43bc27SAndriy Gapon  */
849b43bc27SAndriy Gapon #define	VM_LOW_KMEM	0x01
859b43bc27SAndriy Gapon #define	VM_LOW_PAGES	0x02
86*81a34d37SGleb Smirnoff #define	VM_LOW_MBUFS	0x04
879b43bc27SAndriy Gapon 
889b43bc27SAndriy Gapon /*
89df8bae1dSRodney W. Grimes  *	Exported routines.
90df8bae1dSRodney W. Grimes  */
91df8bae1dSRodney W. Grimes 
92df8bae1dSRodney W. Grimes /*
93df8bae1dSRodney W. Grimes  *	Signal pageout-daemon and wait for it.
94df8bae1dSRodney W. Grimes  */
95df8bae1dSRodney W. Grimes 
962c0f13aaSKonstantin Belousov void vm_wait(vm_object_t obj);
9789d2fb14SKonstantin Belousov int vm_wait_intr(vm_object_t obj);
98245139c6SKonstantin Belousov void vm_waitpfault(struct domainset *, int timo);
99e2068d0bSJeff Roberson void vm_wait_domain(int domain);
100e2068d0bSJeff Roberson void vm_wait_min(void);
101e2068d0bSJeff Roberson void vm_wait_severe(void);
10226f9a767SRodney W. Grimes 
103126d6082SKonstantin Belousov int vm_pageout_flush(vm_page_t *, int, int, int, int *, boolean_t *);
1042025d69bSKonstantin Belousov void vm_pageout_oom(int shortage);
105ac04195bSKonstantin Belousov 
106cd84455fSKonstantin Belousov #endif /* _KERNEL */
107a1287949SEivind Eklund #endif	/* _VM_VM_PAGEOUT_H_ */
108