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: src/share/man/man9/vm_page_free.9,v 1.2 2001/08/08 10:04:08 ru Exp $ |
28 |
.\" $MidnightBSD$ |
29 |
.\" |
30 |
.Dd July 24, 2001 |
31 |
.Dt VM_PAGE_FREE 9 |
32 |
.Os |
33 |
.Sh NAME |
34 |
.Nm vm_page_free , |
35 |
.Nm vm_page_free_toq , |
36 |
.Nm vm_page_free_zero , |
37 |
.Nm vm_page_try_to_free |
38 |
.Nd "free a page" |
39 |
.Sh SYNOPSIS |
40 |
.In sys/param.h |
41 |
.In vm/vm.h |
42 |
.In vm/vm_page.h |
43 |
.Ft void |
44 |
.Fn vm_page_free "vm_page_t m" |
45 |
.Ft void |
46 |
.Fn vm_page_free_toq "vm_page_t m" |
47 |
.Ft void |
48 |
.Fn vm_page_free_zero "vm_page_t m" |
49 |
.Ft int |
50 |
.Fn vm_page_try_to_free "vm_page_t m" |
51 |
.Sh DESCRIPTION |
52 |
The |
53 |
.Fn vm_page_free_toq |
54 |
function moves a page into the free queue, and disassociates it from |
55 |
its object. |
56 |
If the page is held, wired, already free, or its busy count is not |
57 |
zero, the system will panic. |
58 |
If the |
59 |
.Dv PG_ZERO |
60 |
flag is set on the page, it is placed at the end of the free queue; |
61 |
otherwise, it is placed at the front. |
62 |
.Pp |
63 |
If the page's object is of type |
64 |
.Dv OBJT_VNODE |
65 |
and it is the last page associated with the object, the underlying |
66 |
vnode may be freed. |
67 |
.Pp |
68 |
The |
69 |
.Fn vm_page_free |
70 |
and |
71 |
.Fn vm_page_free_zero |
72 |
functions both call |
73 |
.Fn vm_page_free_toq |
74 |
to actually free the page, but |
75 |
.Fn vm_page_free_zero |
76 |
sets the |
77 |
.Dv PG_ZERO |
78 |
flag and |
79 |
.Fn vm_page_free |
80 |
clears the |
81 |
.Dv PG_ZERO |
82 |
flag prior to the call to |
83 |
.Fn vm_page_free_toq . |
84 |
.Pp |
85 |
The |
86 |
.Fn vm_page_try_to_free |
87 |
function verifies that the page is not held, wired, busy or dirty, and |
88 |
if so, marks the page as busy, drops any protection that may be set on |
89 |
the page, and frees it. |
90 |
.Sh RETURN VALUES |
91 |
.Fn vm_page_try_to_free |
92 |
returns 1 if it is able to free the page; otherwise, 0 is returned. |
93 |
.Sh SEE ALSO |
94 |
.Xr vm_page_busy 9 , |
95 |
.Xr vm_page_hold 9 , |
96 |
.Xr vm_page_wire 9 |
97 |
.Sh AUTHORS |
98 |
This manual page was written by |
99 |
.An Chad David Aq davidc@acns.ab.ca . |