xref: /freebsd/share/man/man9/vm_page_grab.9 (revision 315ee00f)
1.\"
2.\" Copyright (C) 2001 Chad David <davidc@acns.ab.ca>. All rights reserved.
3.\" Copyright (c) 2013 The FreeBSD Foundation
4.\"
5.\" Portions of this documentation were written by Konstantin Belousov
6.\" under sponsorship from the FreeBSD Foundation.
7.\"
8.\" Redistribution and use in source and binary forms, with or without
9.\" modification, are permitted provided that the following conditions
10.\" are met:
11.\" 1. Redistributions of source code must retain the above copyright
12.\"    notice(s), this list of conditions and the following disclaimer as
13.\"    the first lines of this file unmodified other than the possible
14.\"    addition of one or more copyright notices.
15.\" 2. Redistributions in binary form must reproduce the above copyright
16.\"    notice(s), this list of conditions and the following disclaimer in the
17.\"    documentation and/or other materials provided with the distribution.
18.\"
19.\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``AS IS'' AND ANY
20.\" EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
21.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22.\" DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE LIABLE FOR ANY
23.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
24.\" (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
25.\" SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
26.\" CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
28.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
29.\" DAMAGE.
30.\"
31.Dd August 23, 2013
32.Dt VM_PAGE_GRAB 9
33.Os
34.Sh NAME
35.Nm vm_page_grab
36.Nd "returns a page from an object"
37.Sh SYNOPSIS
38.In sys/param.h
39.In vm/vm.h
40.In vm/vm_page.h
41.Ft vm_page_t
42.Fn vm_page_grab "vm_object_t object" "vm_pindex_t pindex" "int allocflags"
43.Sh DESCRIPTION
44The
45.Fn vm_page_grab
46function returns the page at
47.Fa pindex
48from the given object.
49If the page exists and is busy,
50.Fn vm_page_grab
51will sleep while waiting for it.
52If the page does not exist, it is allocated.
53The function sleeps until the allocation request can be satisfied.
54.Pp
55The function requires the
56.Fa object
57to be locked on entry, and returns with the object locked.
58If the
59.Fn vm_page_grab
60function sleeps for any reason, the object lock is temporary dropped.
61.Pp
62The
63.Fn vm_page_grab
64supports all of the flags supported by
65.Xr vm_page_alloc 9 .
66In addition,
67.Fn vm_page_grab
68supports the following flags:
69.Bl -tag -width ".Dv VM_ALLOC_IGN_SBUSY"
70.It Dv VM_ALLOC_IGN_SBUSY
71When waiting for the busy state of the existing page to drain,
72only test for exclusive busy; ignore the shared busy counter.
73.El
74.Sh RETURN VALUES
75The
76.Fn vm_page_grab
77always returns the page.
78.Sh SEE ALSO
79.Xr vm_page_alloc 9
80.Sh AUTHORS
81This manual page was written by
82.An Chad David Aq Mt davidc@acns.ab.ca .
83