]> CyberLeo.Net >> Repos - FreeBSD/releng/7.2.git/blob - share/man/man9/vm_page_alloc.9
Create releng/7.2 from stable/7 in preparation for 7.2-RELEASE.
[FreeBSD/releng/7.2.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 July 13, 2001
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, but is not inserted
52 into the pmap.
53 .Pp
54 .Fn vm_page_alloc
55 will not block.
56 .Pp
57 Its arguments are:
58 .Bl -tag -width ".Fa page_req"
59 .It Fa object
60 The VM object to allocate the page for.
61 .It Fa pindex
62 The index into the object at which the page should be inserted.
63 .It Fa page_req
64 A flag indicating how the page should be allocated.
65 .Bl -tag -width ".Dv VM_ALLOC_INTERRUPT"
66 .It Dv VM_ALLOC_NORMAL
67 The page should be allocated with no special treatment.
68 .It Dv VM_ALLOC_SYSTEM
69 The page can be allocated if the cache queue is empty and the free
70 page count is above the interrupt reserved water mark.
71 If
72 .Dv VM_ALLOC_INTERRUPT
73 is set, the page can be allocated as long as the free page count is
74 greater than zero.
75 This flag should be used only when the system really needs the page.
76 .It Dv VM_ALLOC_INTERRUPT
77 .Fn vm_page_alloc
78 is being called during an interrupt and therefore the cache cannot
79 be accessed.
80 The page will only be returned successfully if the free count is greater
81 than zero.
82 .It Dv VM_ALLOC_ZERO
83 Indicate a preference for a pre-zeroed page.
84 There is no guarantee that the page thus returned will be zeroed, but
85 it will be marked as such.
86 .It Dv VM_ALLOC_NOOBJ
87 The page is associated with an unmanaged memory region, that is, there
88 is no backing VM object.
89 This is typically used to allocate pages within the kernel virtual
90 address space.
91 .El
92 .El
93 .Sh RETURN VALUES
94 The
95 .Vt vm_page_t
96 that was allocated is returned if successful; otherwise,
97 .Dv NULL
98 is returned.
99 .Sh NOTES
100 The pager process is always upgraded to
101 .Dv VM_ALLOC_SYSTEM
102 unless
103 .Dv VM_ALLOC_INTERRUPT
104 is set.
105 .Sh AUTHORS
106 This manual page was written by
107 .An Chad David Aq davidc@acns.ab.ca .