]> CyberLeo.Net >> Repos - FreeBSD/releng/8.1.git/blob - share/man/man9/vm_page_alloc.9
Copy stable/8 to releng/8.1 in preparation for 8.1-RC1.
[FreeBSD/releng/8.1.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 February 27, 2010
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 page_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 page_req ,
55 but is not inserted into a pmap.
56 The page may exists in the vm object cache, in which case it will
57 be reactivated instead, moving from the cache into the object page list.
58 .Pp
59 .Fn vm_page_alloc
60 will not sleep.
61 .Pp
62 Its arguments are:
63 .Bl -tag -width ".Fa page_req"
64 .It Fa object
65 The VM object to allocate the page for.
66 The
67 .Fa object
68 must be locked if
69 .Dv VM_ALLOC_NOOBJ
70 is not specified.
71 .It Fa pindex
72 The index into the object at which the page should be inserted.
73 .It Fa page_req
74 A flag indicating how the page should be allocated.
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 queue is empty and the free
80 page count is above the interrupt reserved water mark.
81 If
82 .Dv VM_ALLOC_INTERRUPT
83 is set, the page can be allocated as long as the free page count is
84 greater than zero.
85 This flag should be used only when the system really needs the page.
86 .It Dv VM_ALLOC_INTERRUPT
87 .Fn vm_page_alloc
88 is being called during an interrupt and therefore the cache cannot
89 be accessed.
90 The page will only be returned successfully if the free count is greater
91 than zero.
92 .It Dv VM_ALLOC_ZERO
93 Indicate a preference for a pre-zeroed page.
94 There is no guarantee that the page thus returned will be zeroed, but
95 it will be marked by
96 .Dv PG_ZERO
97 flag if it is zeroed.
98 .It Dv VM_ALLOC_NOOBJ
99 Do not associate the allocated page with a vm object.
100 The
101 .Fa object
102 argument is ignored.
103 .It Dv VM_ALLOC_NOBUSY
104 The page returned will not be busied.
105 .It Dv VM_ALLOC_WIRED
106 The returned page is wired.
107 .It Dv VM_ALLOC_IFNOTCACHED
108 Only allocate the page if it is not cached in the
109 .Fa object .
110 If the page at the specified
111 .Fa pindex
112 is cached, NULL is returned instead.
113 .El
114 .El
115 .Sh RETURN VALUES
116 The
117 .Vt vm_page_t
118 that was allocated is returned if successful; otherwise,
119 .Dv NULL
120 is returned.
121 .Sh NOTES
122 The pager process is always upgraded to
123 .Dv VM_ALLOC_SYSTEM
124 unless
125 .Dv VM_ALLOC_INTERRUPT
126 is set.
127 .Sh AUTHORS
128 This manual page was written by
129 .An Chad David Aq davidc@acns.ab.ca .