1.\" $NetBSD: uvm_obj_wirepages.9,v 1.2 2024/06/14 14:36:32 uwe Exp $ 2.\" 3.\" Copyright (c) 2024 The NetBSD Foundation, Inc. 4.\" All rights reserved. 5.\" 6.\" Redistribution and use in source and binary forms, with or without 7.\" modification, are permitted provided that the following conditions 8.\" are met: 9.\" 1. Redistributions of source code must retain the above copyright 10.\" notice, this list of conditions and the following disclaimer. 11.\" 2. Redistributions in binary form must reproduce the above copyright 12.\" notice, this list of conditions and the following disclaimer in the 13.\" documentation and/or other materials provided with the distribution. 14.\" 15.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 16.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 17.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 18.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 19.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 20.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 21.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 23.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 24.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 25.\" POSSIBILITY OF SUCH DAMAGE. 26.\" 27.Dd June 14, 2024 28.Dt UVM_OBJ_WIREPAGES 9 29.Os 30.Sh NAME 31.Nm uvm_obj_wirepages 32.Nm uvm_obj_unwirepages 33.Nd temporarily wire pages of a UVM object into RAM 34.Sh SYNOPSIS 35.In uvm/uvm_extern.h 36.Ft int 37.Fn uvm_obj_wirepages "struct uvm_object *uobj" "off_t start" "off_t end" "struct pglist *list" 38.Ft void 39.Fn uvm_obj_unwirepages "struct uvm_object *uobj" "off_t start" "off_t end" 40.Sh DESCRIPTION 41.Fn uvm_obj_wirepages 42temporarily wires a range of pages in a UVM object into RAM. 43If any pages from 44.Fa start 45(inclusive) 46to 47.Fa end 48(exclusive) 49are currently paged out, it pages them back in first, and arranges that 50the pages in the range will not be paged out until unwired with 51.Fn uvm_obj_unwirepages . 52.Pp 53If 54.Fa list 55is nonnull, it is initialized to a tailq of pages linked through the 56.Fa pageq.queue 57member of 58.Vt struct vm_page , 59for the convenience of the caller. 60The caller is not transferred ownership of any part of 61.Fa list 62and need not free anything afterward \(em 63.Fn uvm_obj_unwirepages 64will free the pages when done. 65.Pp 66.Fa start 67and 68.Fa end 69must be page-aligned. 70.Pp 71Calls to 72.Fn uvm_obj_wirepages 73must be matched by 74.Fn uvm_obj_unwirepages 75with the same range. 76.Pp 77Overlapping ranges may be simultaneously wired; each page may be wired 78up to 2^32 - 1 times, and will not be paged out until all ranges 79covering it have been unwired. 80.Sh RETURN VALUES 81The 82.Fn uvm_obj_wirepages 83function returns zero on success, or returns an 84.Xr errno 3 85error code and leaves the wired status of all pages unchanged on 86failure. 87.Sh SEE ALSO 88.Xr mlock 3 , 89.Xr uvm 9 , 90.Xr uvm_map 9 91