xref: /freebsd/sys/vm/vm_reserv.h (revision a0409676120c1e558d0ade943019934e0f15118d)
1 /*-
2  * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
3  *
4  * Copyright (c) 2002-2006 Rice University
5  * Copyright (c) 2007-2008 Alan L. Cox <alc@cs.rice.edu>
6  * All rights reserved.
7  *
8  * This software was developed for the FreeBSD Project by Alan L. Cox,
9  * Olivier Crameri, Peter Druschel, Sitaram Iyer, and Juan Navarro.
10  *
11  * Redistribution and use in source and binary forms, with or without
12  * modification, are permitted provided that the following conditions
13  * are met:
14  * 1. Redistributions of source code must retain the above copyright
15  *    notice, this list of conditions and the following disclaimer.
16  * 2. Redistributions in binary form must reproduce the above copyright
17  *    notice, this list of conditions and the following disclaimer in the
18  *    documentation and/or other materials provided with the distribution.
19  *
20  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23  * A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT
24  * HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
25  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
26  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
27  * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
28  * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY
30  * WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
31  * POSSIBILITY OF SUCH DAMAGE.
32  *
33  * $FreeBSD$
34  */
35 
36 /*
37  *	Superpage reservation management definitions
38  */
39 
40 #ifndef	_VM_RESERV_H_
41 #define	_VM_RESERV_H_
42 
43 #ifdef _KERNEL
44 
45 #if VM_NRESERVLEVEL > 0
46 
47 /*
48  * The following functions are only to be used by the virtual memory system.
49  */
50 vm_page_t	vm_reserv_alloc_contig(vm_object_t object, vm_pindex_t pindex,
51 		    int domain, int req, vm_page_t mpred, u_long npages,
52 		    vm_paddr_t low, vm_paddr_t high, u_long alignment,
53 		    vm_paddr_t boundary);
54 vm_page_t	vm_reserv_alloc_page(vm_object_t object, vm_pindex_t pindex,
55 		    int domain, int req, vm_page_t mpred);
56 void		vm_reserv_break_all(vm_object_t object);
57 boolean_t	vm_reserv_free_page(vm_page_t m);
58 void		vm_reserv_init(void);
59 bool		vm_reserv_is_page_free(vm_page_t m);
60 int		vm_reserv_level(vm_page_t m);
61 int		vm_reserv_level_iffullpop(vm_page_t m);
62 bool		vm_reserv_reclaim_contig(int domain, u_long npages,
63 		    vm_paddr_t low, vm_paddr_t high, u_long alignment,
64 		    vm_paddr_t boundary);
65 bool		vm_reserv_reclaim_inactive(int domain);
66 void		vm_reserv_rename(vm_page_t m, vm_object_t new_object,
67 		    vm_object_t old_object, vm_pindex_t old_object_offset);
68 int		vm_reserv_size(int level);
69 vm_paddr_t	vm_reserv_startup(vm_offset_t *vaddr, vm_paddr_t end);
70 vm_page_t	vm_reserv_to_superpage(vm_page_t m);
71 
72 #endif	/* VM_NRESERVLEVEL > 0 */
73 #endif	/* _KERNEL */
74 #endif	/* !_VM_RESERV_H_ */
75