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