121642577SAlfred Perlstein.\" 221642577SAlfred Perlstein.\" Copyright (C) 2001 Chad David <davidc@acns.ab.ca>. All rights reserved. 300cf6892SKonstantin Belousov.\" Copyright (c) 2013 The FreeBSD Foundation 400cf6892SKonstantin Belousov.\" 500cf6892SKonstantin Belousov.\" Portions of this documentation were written by Konstantin Belousov 600cf6892SKonstantin Belousov.\" under sponsorship from the FreeBSD Foundation. 721642577SAlfred Perlstein.\" 821642577SAlfred Perlstein.\" Redistribution and use in source and binary forms, with or without 921642577SAlfred Perlstein.\" modification, are permitted provided that the following conditions 1021642577SAlfred Perlstein.\" are met: 1121642577SAlfred Perlstein.\" 1. Redistributions of source code must retain the above copyright 1221642577SAlfred Perlstein.\" notice(s), this list of conditions and the following disclaimer as 1321642577SAlfred Perlstein.\" the first lines of this file unmodified other than the possible 1421642577SAlfred Perlstein.\" addition of one or more copyright notices. 1521642577SAlfred Perlstein.\" 2. Redistributions in binary form must reproduce the above copyright 1621642577SAlfred Perlstein.\" notice(s), this list of conditions and the following disclaimer in the 1721642577SAlfred Perlstein.\" documentation and/or other materials provided with the distribution. 1821642577SAlfred Perlstein.\" 1921642577SAlfred Perlstein.\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``AS IS'' AND ANY 2021642577SAlfred Perlstein.\" EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 2121642577SAlfred Perlstein.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 2221642577SAlfred Perlstein.\" DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE LIABLE FOR ANY 2321642577SAlfred Perlstein.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 2421642577SAlfred Perlstein.\" (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 2521642577SAlfred Perlstein.\" SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 2621642577SAlfred Perlstein.\" CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 2721642577SAlfred Perlstein.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 2821642577SAlfred Perlstein.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH 2921642577SAlfred Perlstein.\" DAMAGE. 3021642577SAlfred Perlstein.\" 3100cf6892SKonstantin Belousov.Dd August 23, 2013 3221642577SAlfred Perlstein.Dt VM_PAGE_GRAB 9 3321642577SAlfred Perlstein.Os 3421642577SAlfred Perlstein.Sh NAME 3521642577SAlfred Perlstein.Nm vm_page_grab 3621642577SAlfred Perlstein.Nd "returns a page from an object" 3721642577SAlfred Perlstein.Sh SYNOPSIS 3821642577SAlfred Perlstein.In sys/param.h 3921642577SAlfred Perlstein.In vm/vm.h 4021642577SAlfred Perlstein.In vm/vm_page.h 4121642577SAlfred Perlstein.Ft vm_page_t 4221642577SAlfred Perlstein.Fn vm_page_grab "vm_object_t object" "vm_pindex_t pindex" "int allocflags" 4321642577SAlfred Perlstein.Sh DESCRIPTION 4421642577SAlfred PerlsteinThe 4521642577SAlfred Perlstein.Fn vm_page_grab 4621642577SAlfred Perlsteinfunction returns the page at 4721642577SAlfred Perlstein.Fa pindex 4821642577SAlfred Perlsteinfrom the given object. 491f620c2eSRuslan ErmilovIf the page exists and is busy, 5021642577SAlfred Perlstein.Fn vm_page_grab 5121642577SAlfred Perlsteinwill sleep while waiting for it. 521f620c2eSRuslan ErmilovIf the page does not exist, it is allocated. 5300cf6892SKonstantin BelousovThe function sleeps until the allocation request can be satisfied. 5421642577SAlfred Perlstein.Pp 5500cf6892SKonstantin BelousovThe function requires the 5600cf6892SKonstantin Belousov.Fa object 5700cf6892SKonstantin Belousovto be locked on entry, and returns with the object locked. 5800cf6892SKonstantin BelousovIf the 5921642577SAlfred Perlstein.Fn vm_page_grab 6000cf6892SKonstantin Belousovfunction sleeps for any reason, the object lock is temporary dropped. 6100cf6892SKonstantin Belousov.Pp 6200cf6892SKonstantin BelousovThe 6300cf6892SKonstantin Belousov.Fn vm_page_grab 6400cf6892SKonstantin Belousovsupports all of the flags supported by 652a6b4327SJohn-Mark Gurney.Xr vm_page_alloc 9 . 6600cf6892SKonstantin BelousovIn addition, 6700cf6892SKonstantin Belousov.Fn vm_page_grab 6800cf6892SKonstantin Belousovsupports the following flags: 6900cf6892SKonstantin Belousov.Bl -tag -width ".Dv VM_ALLOC_IGN_SBUSY" 7000cf6892SKonstantin Belousov.It Dv VM_ALLOC_IGN_SBUSY 7100cf6892SKonstantin BelousovWhen waiting for the busy state of the existing page to drain, 7200cf6892SKonstantin Belousovonly test for exclusive busy; ignore the shared busy counter. 7300cf6892SKonstantin Belousov.El 7400cf6892SKonstantin Belousov.Sh RETURN VALUES 7500cf6892SKonstantin BelousovThe 7600cf6892SKonstantin Belousov.Fn vm_page_grab 7700cf6892SKonstantin Belousovalways returns the page. 7821642577SAlfred Perlstein.Sh SEE ALSO 7921642577SAlfred Perlstein.Xr vm_page_alloc 9 8021642577SAlfred Perlstein.Sh AUTHORS 81571dba6eSHiten PandyaThis manual page was written by 82*8a7314fcSBaptiste Daroussin.An Chad David Aq Mt davidc@acns.ab.ca . 83