]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - share/man/man9/vm_page_alloc.9
accept_filter(9): Fix a mandoc related error
[FreeBSD/FreeBSD.git] / share / man / man9 / vm_page_alloc.9
1 .\"
2 .\" Copyright (C) 2001 Chad David <davidc@acns.ab.ca>. All rights reserved.
3 .\"
4 .\" Redistribution and use in source and binary forms, with or without
5 .\" modification, are permitted provided that the following conditions
6 .\" are met:
7 .\" 1. Redistributions of source code must retain the above copyright
8 .\"    notice(s), this list of conditions and the following disclaimer as
9 .\"    the first lines of this file unmodified other than the possible
10 .\"    addition of one or more copyright notices.
11 .\" 2. Redistributions in binary form must reproduce the above copyright
12 .\"    notice(s), 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 COPYRIGHT HOLDER(S) ``AS IS'' AND ANY
16 .\" EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
17 .\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
18 .\" DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE LIABLE FOR ANY
19 .\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
20 .\" (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
21 .\" SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
22 .\" CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
25 .\" DAMAGE.
26 .\"
27 .\" $FreeBSD$
28 .\"
29 .Dd November 16, 2016
30 .Dt VM_PAGE_ALLOC 9
31 .Os
32 .Sh NAME
33 .Nm vm_page_alloc
34 .Nd "allocate a page for a"
35 .Vt vm_object
36 .Sh SYNOPSIS
37 .In sys/param.h
38 .In vm/vm.h
39 .In vm/vm_page.h
40 .Ft vm_page_t
41 .Fn vm_page_alloc "vm_object_t object" "vm_pindex_t pindex" "int req"
42 .Sh DESCRIPTION
43 The
44 .Fn vm_page_alloc
45 function allocates a page at
46 .Fa pindex
47 within
48 .Fa object .
49 It is assumed that a page has not already been allocated at
50 .Fa pindex .
51 The page returned is inserted into the object, unless
52 .Dv VM_ALLOC_NOOBJ
53 is specified in the
54 .Fa req .
55 .Pp
56 .Fn vm_page_alloc
57 will not sleep.
58 .Pp
59 Its arguments are:
60 .Bl -tag -width ".Fa object"
61 .It Fa object
62 The VM object to allocate the page for.
63 The
64 .Fa object
65 must be locked if
66 .Dv VM_ALLOC_NOOBJ
67 is not specified.
68 .It Fa pindex
69 The index into the object at which the page should be inserted.
70 .It Fa req
71 The bitwise-inclusive OR of a class and any optional flags indicating
72 how the page should be allocated.
73 .Pp
74 Exactly one of the following classes must be specified:
75 .Bl -tag -width ".Dv VM_ALLOC_INTERRUPT"
76 .It Dv VM_ALLOC_NORMAL
77 The page should be allocated with no special treatment.
78 .It Dv VM_ALLOC_SYSTEM
79 The page can be allocated if the cache is empty and the free
80 page count is above the interrupt reserved water mark.
81 This flag should be used only when the system really needs the page.
82 .It Dv VM_ALLOC_INTERRUPT
83 .Fn vm_page_alloc
84 is being called during an interrupt.
85 A page will be returned successfully if the free page count is greater
86 than zero.
87 .El
88 .Pp
89 The optional flags are:
90 .Bl -tag -width ".Dv VM_ALLOC_NOBUSY"
91 .It Dv VM_ALLOC_NOBUSY
92 The returned page will not be exclusive busy.
93 .It Dv VM_ALLOC_NODUMP
94 The returned page will not be included in any kernel core dumps
95 regardless of whether or not it is mapped in to KVA.
96 .It Dv VM_ALLOC_NOOBJ
97 Do not associate the allocated page with a vm object.
98 The
99 .Fa object
100 argument is ignored.
101 .It Dv VM_ALLOC_SBUSY
102 The returned page will be shared busy.
103 .It Dv VM_ALLOC_WIRED
104 The returned page will be wired.
105 .It Dv VM_ALLOC_ZERO
106 Indicate a preference for a pre-zeroed page.
107 There is no guarantee that the returned page will be zeroed, but it
108 will have the
109 .Dv PG_ZERO
110 flag set if it is zeroed.
111 .El
112 .El
113 .Sh RETURN VALUES
114 The
115 .Vt vm_page_t
116 that was allocated is returned if successful; otherwise,
117 .Dv NULL
118 is returned.
119 .Sh NOTES
120 The pager process is always upgraded to
121 .Dv VM_ALLOC_SYSTEM
122 unless
123 .Dv VM_ALLOC_INTERRUPT
124 is set.
125 .Sh AUTHORS
126 This manual page was written by
127 .An Chad David Aq Mt davidc@acns.ab.ca .