]> CyberLeo.Net >> Repos - FreeBSD/releng/10.0.git/blob - share/man/man9/vm_page_bits.9
- Copy stable/10 (r259064) to releng/10.0 as part of the
[FreeBSD/releng/10.0.git] / share / man / man9 / vm_page_bits.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 December 1, 2001
30 .Dt VM_PAGE_BITS 9
31 .Os
32 .Sh NAME
33 .Nm vm_page_bits ,
34 .Nm vm_page_set_validclean ,
35 .Nm vm_page_clear_dirty ,
36 .Nm vm_page_set_invalid ,
37 .Nm vm_page_zero_invalid ,
38 .Nm vm_page_is_valid ,
39 .Nm vm_page_test_dirty ,
40 .Nm vm_page_dirty ,
41 .Nm vm_page_undirty
42 .Nd "manage page clean and dirty bits"
43 .Sh SYNOPSIS
44 .In sys/param.h
45 .In vm/vm.h
46 .In vm/vm_page.h
47 .Ft int
48 .Fn vm_page_bits "int base" "int size"
49 .Ft void
50 .Fn vm_page_set_validclean "vm_page_t m" "int base" "int size"
51 .Ft void
52 .Fn vm_page_clear_dirty "vm_page_t m" "int base" "int size"
53 .Ft void
54 .Fn vm_page_set_invalid "vm_page_t m" "int base" "int size"
55 .Ft void
56 .Fn vm_page_zero_invalid "vm_page_t m" "boolean_t setvalid"
57 .Ft int
58 .Fn vm_page_is_valid "vm_page_t m" "int base" "int size"
59 .Ft void
60 .Fn vm_page_test_dirty "vm_page_t m"
61 .Ft void
62 .Fn vm_page_dirty "vm_page_t m"
63 .Ft void
64 .Fn vm_page_undirty "vm_page_t m"
65 .Sh DESCRIPTION
66 .Fn vm_page_bits
67 calculates the bits representing the
68 .Dv DEV_BSIZE
69 range of bytes between
70 .Fa base
71 and
72 .Fa size .
73 The byte range is expected to be within a single page, and if
74 .Fa size
75 is zero, no bits will be set.
76 .Pp
77 .Fn vm_page_set_validclean
78 flags the byte range between
79 .Fa base
80 and
81 .Fa size
82 as valid and clean.
83 The range is expected to be
84 .Dv DEV_BSIZE
85 aligned and no larger than
86 .Dv PAGE_SIZE .
87 If it is not properly aligned, any unaligned chunks of the
88 .Dv DEV_BSIZE
89 blocks at the beginning and end of the range will be zeroed.
90 .Pp
91 If
92 .Fa base
93 is zero and
94 .Fa size
95 is one page, the modified bit in the page map is cleared; as well,
96 the
97 .Dv VPO_NOSYNC
98 flag is cleared.
99 .Pp
100 .Fn vm_page_clear_dirty
101 clears the dirty bits within a page in the range between
102 .Fa base
103 and
104 .Fa size .
105 The bits representing the range are calculated by calling
106 .Fn vm_page_bits .
107 .Pp
108 .Fn vm_page_set_invalid
109 clears the bits in both the valid and dirty flags representing
110 the
111 .Dv DEV_BSIZE
112 blocks between
113 .Fa base
114 and
115 .Fa size
116 in the page.
117 The bits are calculated by calling
118 .Fn vm_page_bits .
119 As well as clearing the bits within the page, the generation
120 number within the object holding the page is incremented.
121 .Pp
122 .Fn vm_page_zero_invalid
123 zeroes all of the blocks within the page that are currently
124 flagged as invalid.
125 If
126 .Fa setvalid
127 is
128 .Dv TRUE ,
129 all of the valid bits within the page are set.
130 .Pp
131 In some cases, such as NFS, the valid bits cannot be set
132 in order to maintain cache consistency.
133 .Pp
134 .Fn vm_page_is_valid
135 checks to determine if the all of the
136 .Dv DEV_BSIZE
137 blocks between
138 .Fa base
139 and
140 .Fa size
141 of the page are valid.
142 If
143 .Fa size
144 is zero and the page is entirely invalid
145 .Fn vm_page_is_valid
146 will return
147 .Dv TRUE ,
148 in all other cases a size of zero will return
149 .Dv FALSE .
150 .Pp
151 .Fn vm_page_test_dirty
152 checks if a page has been modified via any of its physical maps,
153 and if so, flags the entire page as dirty.
154 .Fn vm_page_dirty
155 is called to modify the dirty bits.
156 .Pp
157 .Fn vm_page_dirty
158 flags the entire page as dirty.
159 It is expected that the page is not currently on the cache queue.
160 .Pp
161 .Fn vm_page_undirty
162 clears all of the dirty bits in a page.
163 .Sh NOTES
164 None of these functions are allowed to block.
165 .Sh AUTHORS
166 This manual page was written by
167 .An Chad David Aq davidc@acns.ab.ca .