xref: /freebsd/share/man/man9/vm_map_wire.9 (revision 2e3507c25e42292b45a5482e116d278f5515d04d)
1.\"
2.\" Copyright (c) 2003 Bruce M Simpson <bms@spc.org>
3.\" All rights reserved.
4.\"
5.\" Redistribution and use in source and binary forms, with or without
6.\" modification, are permitted provided that the following conditions
7.\" are met:
8.\" 1. Redistributions of source code must retain the above copyright
9.\"    notice, this list of conditions and the following disclaimer.
10.\" 2. Redistributions in binary form must reproduce the above copyright
11.\"    notice, this list of conditions and the following disclaimer in the
12.\"    documentation and/or other materials provided with the distribution.
13.\"
14.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24.\" SUCH DAMAGE.
25.\"
26.Dd July 19, 2003
27.Dt VM_MAP_WIRE 9
28.Os
29.Sh NAME
30.Nm vm_map_wire ,
31.Nm vm_map_unwire
32.Nd manage page wiring within a virtual memory map
33.Sh SYNOPSIS
34.In sys/param.h
35.In vm/vm.h
36.In vm/vm_map.h
37.Ft int
38.Fn vm_map_wire "vm_map_t map" "vm_offset_t start" "vm_offset_t end" "int flags"
39.Ft int
40.Fo vm_map_unwire
41.Fa "vm_map_t map" "vm_offset_t start" "vm_offset_t end" "int flags"
42.Fc
43.Sh DESCRIPTION
44The
45.Fn vm_map_wire
46function is responsible for wiring pages in the range between
47.Fa start
48and
49.Fa end
50within the map
51.Fa map .
52Wired pages are locked into physical memory, and may not be paged out
53as long as their wire count remains above zero.
54.Pp
55The
56.Fn vm_map_unwire
57function performs the corresponding unwire operation.
58.Pp
59The
60.Fa flags
61argument is a bit mask, consisting of the following flags:
62.Pp
63If the
64.Dv VM_MAP_WIRE_USER
65flag is set, the function operates within user address space.
66.Pp
67If the
68.Dv VM_MAP_WIRE_HOLESOK
69flag is set, it may operate upon an arbitrary range within the
70address space of
71.Fa map .
72.Pp
73If a contiguous range is desired, callers should explicitly express
74their intent by specifying the
75.Dv VM_MAP_WIRE_NOHOLES
76flag.
77.Sh IMPLEMENTATION NOTES
78Both functions will attempt to acquire a lock on the map using
79.Xr vm_map_lock 9
80and hold it for the duration of the call.
81If they detect
82.Dv MAP_ENTRY_IN_TRANSITION ,
83they will call
84.Xr vm_map_unlock_and_wait 9
85until the map becomes available again.
86.Pp
87The map could have changed during this window as it was held by another
88consumer, therefore consumers of this interface should check for this
89condition using the return values below.
90.Sh RETURN VALUES
91The
92.Fn vm_map_wire
93and
94.Fn vm_map_unwire
95functions have identical return values.
96The functions return
97.Dv KERN_SUCCESS
98if all pages within the range were [un]wired successfully.
99.Pp
100Otherwise, if the specified range was not valid,
101or if the map changed while the
102.Dv MAP_ENTRY_IN_TRANSITION
103flag was set,
104.Dv KERN_INVALID_ADDRESS
105is returned.
106.Sh SEE ALSO
107.Xr mlockall 2 ,
108.Xr munlockall 2 ,
109.Xr vm_map 9
110.Sh AUTHORS
111This manual page was written by
112.An Bruce M Simpson Aq Mt bms@spc.org .
113