xref: /freebsd/sys/vm/vm_reserv.h (revision eb69d1f144a6fcc765d1b9d44a5ae8082353e70b)
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, u_long npages, vm_paddr_t low, vm_paddr_t high,
52 		    u_long alignment, vm_paddr_t boundary, vm_page_t mpred);
53 vm_page_t	vm_reserv_extend_contig(int req, vm_object_t object,
54 		    vm_pindex_t pindex, int domain, u_long npages,
55 		    vm_paddr_t low, vm_paddr_t high, u_long alignment,
56 		    vm_paddr_t boundary, vm_page_t mpred);
57 vm_page_t	vm_reserv_alloc_page(vm_object_t object, vm_pindex_t pindex,
58 		    int domain, vm_page_t mpred);
59 vm_page_t	vm_reserv_extend(int req, vm_object_t object,
60 		    vm_pindex_t pindex, int domain, vm_page_t mpred);
61 void		vm_reserv_break_all(vm_object_t object);
62 boolean_t	vm_reserv_free_page(vm_page_t m);
63 void		vm_reserv_init(void);
64 bool		vm_reserv_is_page_free(vm_page_t m);
65 int		vm_reserv_level(vm_page_t m);
66 int		vm_reserv_level_iffullpop(vm_page_t m);
67 boolean_t	vm_reserv_reclaim_contig(int domain, u_long npages,
68 		    vm_paddr_t low, vm_paddr_t high, u_long alignment,
69 		    vm_paddr_t boundary);
70 boolean_t	vm_reserv_reclaim_inactive(int domain);
71 void		vm_reserv_rename(vm_page_t m, vm_object_t new_object,
72 		    vm_object_t old_object, vm_pindex_t old_object_offset);
73 int		vm_reserv_size(int level);
74 vm_paddr_t	vm_reserv_startup(vm_offset_t *vaddr, vm_paddr_t end,
75 		    vm_paddr_t high_water);
76 vm_page_t	vm_reserv_to_superpage(vm_page_t m);
77 
78 #endif	/* VM_NRESERVLEVEL > 0 */
79 #endif	/* _KERNEL */
80 #endif	/* !_VM_RESERV_H_ */
81