xref: /freebsd/sys/vm/vm_reserv.h (revision 1526667bc6e2c1042010de25e7a0226c0f1b44be)
1 /*-
2  * SPDX-License-Identifier: BSD-2-Clause
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 
34 /*
35  *	Superpage reservation management definitions
36  */
37 
38 #ifndef	_VM_RESERV_H_
39 #define	_VM_RESERV_H_
40 
41 #ifdef _KERNEL
42 
43 #if VM_NRESERVLEVEL > 0
44 
45 /*
46  * The following functions are only to be used by the virtual memory system.
47  */
48 vm_page_t	vm_reserv_alloc_contig(vm_object_t object, vm_pindex_t pindex,
49 		    int domain, int req, vm_page_t mpred, u_long npages,
50 		    vm_paddr_t low, vm_paddr_t high, u_long alignment,
51 		    vm_paddr_t boundary);
52 vm_page_t	vm_reserv_alloc_page(vm_object_t object, vm_pindex_t pindex,
53 		    int domain, int req, vm_page_t mpred);
54 void		vm_reserv_break_all(vm_object_t object);
55 boolean_t	vm_reserv_free_page(vm_page_t m);
56 void		vm_reserv_init(void);
57 bool		vm_reserv_is_page_free(vm_page_t m);
58 bool		vm_reserv_is_populated(vm_page_t m, int npages);
59 int		vm_reserv_level(vm_page_t m);
60 int		vm_reserv_level_iffullpop(vm_page_t m);
61 vm_page_t	vm_reserv_reclaim_contig(int domain, u_long npages,
62 		    vm_paddr_t low, vm_paddr_t high, u_long alignment,
63 		    vm_paddr_t boundary);
64 bool		vm_reserv_reclaim_inactive(int domain);
65 void		vm_reserv_rename(vm_page_t m, vm_object_t new_object,
66 		    vm_object_t old_object, vm_pindex_t old_object_offset);
67 int		vm_reserv_size(int level);
68 vm_paddr_t	vm_reserv_startup(vm_offset_t *vaddr, vm_paddr_t end);
69 vm_page_t	vm_reserv_to_superpage(vm_page_t m);
70 
71 #endif	/* VM_NRESERVLEVEL > 0 */
72 #endif	/* _KERNEL */
73 #endif	/* !_VM_RESERV_H_ */
74