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