16484c361SAlfred Perlstein.\" 26484c361SAlfred Perlstein.\" Copyright (C) 2001 Chad David <davidc@acns.ab.ca>. All rights reserved. 36484c361SAlfred Perlstein.\" 46484c361SAlfred Perlstein.\" Redistribution and use in source and binary forms, with or without 56484c361SAlfred Perlstein.\" modification, are permitted provided that the following conditions 66484c361SAlfred Perlstein.\" are met: 76484c361SAlfred Perlstein.\" 1. Redistributions of source code must retain the above copyright 86484c361SAlfred Perlstein.\" notice(s), this list of conditions and the following disclaimer as 96484c361SAlfred Perlstein.\" the first lines of this file unmodified other than the possible 106484c361SAlfred Perlstein.\" addition of one or more copyright notices. 116484c361SAlfred Perlstein.\" 2. Redistributions in binary form must reproduce the above copyright 126484c361SAlfred Perlstein.\" notice(s), this list of conditions and the following disclaimer in the 136484c361SAlfred Perlstein.\" documentation and/or other materials provided with the distribution. 146484c361SAlfred Perlstein.\" 156484c361SAlfred Perlstein.\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``AS IS'' AND ANY 166484c361SAlfred Perlstein.\" EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 176484c361SAlfred Perlstein.\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 186484c361SAlfred Perlstein.\" DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE LIABLE FOR ANY 196484c361SAlfred Perlstein.\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 206484c361SAlfred Perlstein.\" (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 216484c361SAlfred Perlstein.\" SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 226484c361SAlfred Perlstein.\" CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 236484c361SAlfred Perlstein.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 246484c361SAlfred Perlstein.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH 256484c361SAlfred Perlstein.\" DAMAGE. 266484c361SAlfred Perlstein.\" 276484c361SAlfred Perlstein.\" $FreeBSD$ 286484c361SAlfred Perlstein.\" 296484c361SAlfred Perlstein.Dd July 13, 2001 306484c361SAlfred Perlstein.Dt VM_PAGE_ALLOC 9 316484c361SAlfred Perlstein.Os 326484c361SAlfred Perlstein.Sh NAME 336484c361SAlfred Perlstein.Nm vm_page_alloc 342e693d19SChad David.Nd "allocate a page for a vm_object" 356484c361SAlfred Perlstein.Sh SYNOPSIS 366484c361SAlfred Perlstein.In sys/param.h 376484c361SAlfred Perlstein.In vm/vm.h 386484c361SAlfred Perlstein.In vm/vm_page.h 396484c361SAlfred Perlstein.Ft vm_page_t 406484c361SAlfred Perlstein.Fn vm_page_alloc "vm_object_t object" "vm_pindex_t pindex" "int page_req" 416484c361SAlfred Perlstein.Sh DESCRIPTION 426484c361SAlfred PerlsteinThe 436484c361SAlfred Perlstein.Fn vm_page_alloc 442e693d19SChad Davidfunction allocates a page at 456484c361SAlfred Perlstein.Fa pindex 462e693d19SChad Davidwithin 476484c361SAlfred Perlstein.Fa object . 482e693d19SChad DavidIt is assumed that a page has not already been allocated at 492e693d19SChad David.Fa pindex . 502e693d19SChad DavidThe page returned is inserted into the object, but is not inserted 512e693d19SChad Davidinto the pmap. 526484c361SAlfred Perlstein.Pp 536484c361SAlfred Perlstein.Fn vm_page_alloc 542e693d19SChad Davidwill not block. 556484c361SAlfred Perlstein.Pp 566484c361SAlfred PerlsteinIts arguments are: 576484c361SAlfred Perlstein.Bl -tag -width ".Fa page_req" 586484c361SAlfred Perlstein.It Fa object 596484c361SAlfred PerlsteinThe VM object to allocate the page for. 606484c361SAlfred Perlstein.It Fa pindex 612e693d19SChad DavidThe index into the object at which the page should be inserted. 626484c361SAlfred Perlstein.It Fa page_req 636484c361SAlfred PerlsteinA flag indicating how the page should be allocated. 646484c361SAlfred Perlstein.Bl -tag -width ".Dv VM_ALLOC_INTERRUPT" 656484c361SAlfred Perlstein.It Dv VM_ALLOC_NORMAL 666484c361SAlfred PerlsteinThe page should be allocated with no special treatment. 676484c361SAlfred Perlstein.It Dv VM_ALLOC_SYSTEM 682e693d19SChad DavidThe page can be allocated if the cache queue is empty and the free 692e693d19SChad Davidpage count is above the interrupt reserved water mark. 702e693d19SChad DavidIf 712e693d19SChad David.Dv VM_ALLOC_INTERRUPT 722e693d19SChad Davidis set the page can be allocated as long as the free page count is 732e693d19SChad Davidgreater than zero. 742e693d19SChad DavidThis flag should be used only when the system really needs the page. 756484c361SAlfred Perlstein.It Dv VM_ALLOC_INTERRUPT 766484c361SAlfred Perlstein.Fn vm_page_alloc 776484c361SAlfred Perlsteinis being called during an interrupt and therefore the cache cannot 786484c361SAlfred Perlsteinbe accessed. 796484c361SAlfred PerlsteinThe page will only be returned successfully if the free count is greater 806484c361SAlfred Perlsteinthan zero. 816484c361SAlfred Perlstein.It Dv VM_ALLOC_ZERO 826484c361SAlfred PerlsteinThe same as 836484c361SAlfred Perlstein.Dv VM_ALLOC_NORMAL 846484c361SAlfred Perlsteinexcept the page returned is zeroed. 856484c361SAlfred Perlstein.El 866484c361SAlfred Perlstein.El 876484c361SAlfred Perlstein.Sh RETURN VALUES 882e693d19SChad DavidThe 896484c361SAlfred Perlstein.Vt vm_page_t 902e693d19SChad Davidthat was allocated is returned if successful; otherwise, 916484c361SAlfred Perlstein.Dv NULL 926484c361SAlfred Perlsteinis returned. 936484c361SAlfred Perlstein.Sh NOTES 946484c361SAlfred PerlsteinThe pager process is always upgraded to 956484c361SAlfred Perlstein.Dv VM_ALLOC_SYSTEM 966484c361SAlfred Perlsteinunless 976484c361SAlfred Perlstein.Dv VM_ALLOC_INTERRUPT 986484c361SAlfred Perlsteinis set. 996484c361SAlfred Perlstein.Sh AUTHORS 1006484c361SAlfred PerlsteinThis man page was written by 1016484c361SAlfred Perlstein.An Chad David Aq davidc@acns.ab.ca . 102