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