xref: /freebsd/share/man/man9/vm_map_wire.9 (revision d3d381b2b194b4d24853e92eecef55f262688d1a)
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.\" $FreeBSD$
27.\"
28.Dd July 19, 2003
29.Dt VM_MAP_WIRE 9
30.Os
31.Sh NAME
32.Nm vm_map_wire ,
33.Nm vm_map_unwire
34.Nd manage page wiring within a virtual memory map
35.Sh SYNOPSIS
36.In sys/param.h
37.In vm/vm.h
38.In vm/vm_map.h
39.Ft int
40.Fn vm_map_wire "vm_map_t map" "vm_offset_t start" "vm_offset_t end" "int flags"
41.Ft int
42.Fo vm_map_unwire
43.Fa "vm_map_t map" "vm_offset_t start" "vm_offset_t end" "int flags"
44.Fc
45.Sh DESCRIPTION
46The
47.Fn vm_map_wire
48function is responsible for wiring pages in the range between
49.Fa start
50and
51.Fa end
52within the map
53.Fa map .
54Wired pages are locked into physical memory, and may not be paged out
55as long as their wire count remains above zero.
56.Pp
57The
58.Fn vm_map_unwire
59function performs the corresponding unwire operation.
60.Pp
61The
62.Fa flags
63argument is a bit mask, consisting of the following flags:
64.Pp
65If the
66.Dv VM_MAP_WIRE_USER
67flag is set, the function operates within user address space.
68.Pp
69If the
70.Dv VM_MAP_WIRE_HOLESOK
71flag is set, it may operate upon an arbitrary range within the
72address space of
73.Fa map .
74.Pp
75If a contiguous range is desired, callers should explicitly express
76their intent by specifying the
77.Dv VM_MAP_WIRE_NOHOLES
78flag.
79.Sh IMPLEMENTATION NOTES
80Both functions will attempt to acquire a lock on the map using
81.Xr vm_map_lock 9
82and hold it for the duration of the call.
83If they detect
84.Dv MAP_ENTRY_IN_TRANSITION ,
85they will call
86.Xr vm_map_unlock_and_wait 9
87until the map becomes available again.
88.Pp
89The map could have changed during this window as it was held by another
90consumer, therefore consumers of this interface should check for this
91condition using the return values below.
92.Sh RETURN VALUES
93The
94.Fn vm_map_wire
95and
96.Fn vm_map_unwire
97functions have identical return values.
98The functions return
99.Dv KERN_SUCCESS
100if all pages within the range were [un]wired successfully.
101.Pp
102Otherwise, if the specified range was not valid,
103or if the map changed while the
104.Dv MAP_ENTRY_IN_TRANSITION
105flag was set,
106.Dv KERN_INVALID_ADDRESS
107is returned.
108.Sh SEE ALSO
109.Xr mlockall 2 ,
110.Xr munlockall 2 ,
111.Xr vm_map 9
112.Sh AUTHORS
113This manual page was written by
114.An Bruce M Simpson Aq Mt bms@spc.org .
115