vm_pageout.h revision 314664
1254721Semaste/*-
2254721Semaste * Copyright (c) 1991, 1993
3254721Semaste *	The Regents of the University of California.  All rights reserved.
4254721Semaste *
5254721Semaste * This code is derived from software contributed to Berkeley by
6254721Semaste * The Mach Operating System project at Carnegie-Mellon University.
7254721Semaste *
8254721Semaste * Redistribution and use in source and binary forms, with or without
9254721Semaste * modification, are permitted provided that the following conditions
10254721Semaste * are met:
11254721Semaste * 1. Redistributions of source code must retain the above copyright
12254721Semaste *    notice, this list of conditions and the following disclaimer.
13254721Semaste * 2. Redistributions in binary form must reproduce the above copyright
14254721Semaste *    notice, this list of conditions and the following disclaimer in the
15254721Semaste *    documentation and/or other materials provided with the distribution.
16254721Semaste * 4. Neither the name of the University nor the names of its contributors
17254721Semaste *    may be used to endorse or promote products derived from this software
18254721Semaste *    without specific prior written permission.
19254721Semaste *
20254721Semaste * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
21254721Semaste * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22254721Semaste * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23254721Semaste * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
24254721Semaste * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25254721Semaste * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26254721Semaste * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27254721Semaste * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28254721Semaste * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29254721Semaste * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30254721Semaste * SUCH DAMAGE.
31254721Semaste *
32254721Semaste *	from: @(#)vm_pageout.h	8.2 (Berkeley) 1/12/94
33254721Semaste *
34254721Semaste *
35254721Semaste * Copyright (c) 1987, 1990 Carnegie-Mellon University.
36254721Semaste * All rights reserved.
37254721Semaste *
38254721Semaste * Author: Avadis Tevanian, Jr.
39254721Semaste *
40254721Semaste * Permission to use, copy, modify and distribute this software and
41254721Semaste * its documentation is hereby granted, provided that both the copyright
42254721Semaste * notice and this permission notice appear in all copies of the
43254721Semaste * software, derivative works or modified versions, and any portions
44254721Semaste * thereof, and that both notices appear in supporting documentation.
45254721Semaste *
46254721Semaste * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
47254721Semaste * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
48254721Semaste * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
49254721Semaste *
50254721Semaste * Carnegie Mellon requests users of this software to return to
51254721Semaste *
52254721Semaste *  Software Distribution Coordinator  or  Software.Distribution@CS.CMU.EDU
53254721Semaste *  School of Computer Science
54254721Semaste *  Carnegie Mellon University
55254721Semaste *  Pittsburgh PA 15213-3890
56254721Semaste *
57254721Semaste * any improvements or extensions that they make and grant Carnegie the
58254721Semaste * rights to redistribute these changes.
59254721Semaste *
60254721Semaste * $FreeBSD: stable/10/sys/vm/vm_pageout.h 314664 2017-03-04 12:05:50Z avg $
61254721Semaste */
62254721Semaste
63276479Sdim#ifndef _VM_VM_PAGEOUT_H_
64254721Semaste#define _VM_VM_PAGEOUT_H_
65254721Semaste
66254721Semaste/*
67254721Semaste *	Header file for pageout daemon.
68254721Semaste */
69254721Semaste
70254721Semaste/*
71276479Sdim *	Exported data structures.
72254721Semaste */
73254721Semaste
74280031Sdimextern int vm_page_max_wired;
75280031Sdimextern int vm_pages_needed;	/* should be some "event" structure */
76280031Sdimextern int vm_pageout_pages_needed;
77280031Sdimextern int vm_pageout_deficit;
78280031Sdimextern int vm_pageout_page_count;
79280031Sdim
80280031Sdim/*
81254721Semaste * Swap out requests
82280031Sdim */
83280031Sdim#define VM_SWAP_NORMAL 1
84280031Sdim#define VM_SWAP_IDLE 2
85280031Sdim
86280031Sdim#define	VM_OOM_MEM	1
87280031Sdim#define	VM_OOM_SWAPZ	2
88280031Sdim
89280031Sdim/*
90254721Semaste * vm_lowmem flags.
91254721Semaste */
92254721Semaste#define	VM_LOW_KMEM	0x01
93254721Semaste#define	VM_LOW_PAGES	0x02
94254721Semaste
95276479Sdim/*
96254721Semaste *	Exported routines.
97254721Semaste */
98254721Semaste
99254721Semaste/*
100254721Semaste *	Signal pageout-daemon and wait for it.
101254721Semaste */
102254721Semaste
103254721Semasteextern void pagedaemon_wakeup(void);
104276479Sdim#define VM_WAIT vm_wait()
105254721Semaste#define VM_WAITPFAULT vm_waitpfault()
106254721Semasteextern void vm_wait(void);
107254721Semasteextern void vm_waitpfault(void);
108254721Semaste
109254721Semaste#ifdef _KERNEL
110254721Semasteint vm_pageout_flush(vm_page_t *, int, int, int, int *, boolean_t *);
111254721Semastevoid vm_pageout_grow_cache(int, vm_paddr_t, vm_paddr_t);
112254721Semastevoid vm_pageout_oom(int shortage);
113276479Sdim#endif
114254721Semaste#endif	/* _VM_VM_PAGEOUT_H_ */
115254721Semaste