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