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.\" 29*4fab83ffSAlan Cox.Dd November 16, 2016 306484c361SAlfred Perlstein.Dt VM_PAGE_ALLOC 9 316484c361SAlfred Perlstein.Os 326484c361SAlfred Perlstein.Sh NAME 336484c361SAlfred Perlstein.Nm vm_page_alloc 3463856f96SRuslan Ermilov.Nd "allocate a page for a" 3563856f96SRuslan Ermilov.Vt vm_object 366484c361SAlfred Perlstein.Sh SYNOPSIS 376484c361SAlfred Perlstein.In sys/param.h 386484c361SAlfred Perlstein.In vm/vm.h 396484c361SAlfred Perlstein.In vm/vm_page.h 406484c361SAlfred Perlstein.Ft vm_page_t 41b64400a0SAlan Cox.Fn vm_page_alloc "vm_object_t object" "vm_pindex_t pindex" "int req" 426484c361SAlfred Perlstein.Sh DESCRIPTION 436484c361SAlfred PerlsteinThe 446484c361SAlfred Perlstein.Fn vm_page_alloc 452e693d19SChad Davidfunction allocates a page at 466484c361SAlfred Perlstein.Fa pindex 472e693d19SChad Davidwithin 486484c361SAlfred Perlstein.Fa object . 492e693d19SChad DavidIt is assumed that a page has not already been allocated at 502e693d19SChad David.Fa pindex . 51c46221d7SKonstantin BelousovThe page returned is inserted into the object, unless 52c46221d7SKonstantin Belousov.Dv VM_ALLOC_NOOBJ 53c46221d7SKonstantin Belousovis specified in the 54b64400a0SAlan Cox.Fa req . 556484c361SAlfred Perlstein.Pp 566484c361SAlfred Perlstein.Fn vm_page_alloc 57c46221d7SKonstantin Belousovwill not sleep. 586484c361SAlfred Perlstein.Pp 596484c361SAlfred PerlsteinIts arguments are: 60b64400a0SAlan Cox.Bl -tag -width ".Fa object" 616484c361SAlfred Perlstein.It Fa object 626484c361SAlfred PerlsteinThe VM object to allocate the page for. 63c46221d7SKonstantin BelousovThe 64c46221d7SKonstantin Belousov.Fa object 65c46221d7SKonstantin Belousovmust be locked if 66c46221d7SKonstantin Belousov.Dv VM_ALLOC_NOOBJ 67c46221d7SKonstantin Belousovis not specified. 686484c361SAlfred Perlstein.It Fa pindex 692e693d19SChad DavidThe index into the object at which the page should be inserted. 70b64400a0SAlan Cox.It Fa req 71b64400a0SAlan CoxThe bitwise-inclusive OR of a class and any optional flags indicating 72b64400a0SAlan Coxhow the page should be allocated. 73b64400a0SAlan Cox.Pp 74b64400a0SAlan CoxExactly one of the following classes must be specified: 756484c361SAlfred Perlstein.Bl -tag -width ".Dv VM_ALLOC_INTERRUPT" 766484c361SAlfred Perlstein.It Dv VM_ALLOC_NORMAL 776484c361SAlfred PerlsteinThe page should be allocated with no special treatment. 786484c361SAlfred Perlstein.It Dv VM_ALLOC_SYSTEM 79b64400a0SAlan CoxThe page can be allocated if the cache is empty and the free 802e693d19SChad Davidpage count is above the interrupt reserved water mark. 812e693d19SChad DavidThis flag should be used only when the system really needs the page. 826484c361SAlfred Perlstein.It Dv VM_ALLOC_INTERRUPT 836484c361SAlfred Perlstein.Fn vm_page_alloc 84b64400a0SAlan Coxis being called during an interrupt. 85b64400a0SAlan CoxA page will be returned successfully if the free page count is greater 866484c361SAlfred Perlsteinthan zero. 87b64400a0SAlan Cox.El 88b64400a0SAlan Cox.Pp 89b64400a0SAlan CoxThe optional flags are: 90*4fab83ffSAlan Cox.Bl -tag -width ".Dv VM_ALLOC_NOBUSY" 91e013216eSKip Macy.It Dv VM_ALLOC_NOBUSY 92c7aebda8SAttilio RaoThe returned page will not be exclusive busy. 93e013216eSKip Macy.It Dv VM_ALLOC_NODUMP 94e013216eSKip MacyThe returned page will not be included in any kernel core dumps 95e013216eSKip Macyregardless of whether or not it is mapped in to KVA. 966bcda17fSBruce M Simpson.It Dv VM_ALLOC_NOOBJ 97c46221d7SKonstantin BelousovDo not associate the allocated page with a vm object. 98c46221d7SKonstantin BelousovThe 99c46221d7SKonstantin Belousov.Fa object 100c46221d7SKonstantin Belousovargument is ignored. 101c7aebda8SAttilio Rao.It Dv VM_ALLOC_SBUSY 102c7aebda8SAttilio RaoThe returned page will be shared busy. 103e013216eSKip Macy.It Dv VM_ALLOC_WIRED 104e013216eSKip MacyThe returned page will be wired. 105e013216eSKip Macy.It Dv VM_ALLOC_ZERO 106e013216eSKip MacyIndicate a preference for a pre-zeroed page. 107e013216eSKip MacyThere is no guarantee that the returned page will be zeroed, but it 108e013216eSKip Macywill have the 109e013216eSKip Macy.Dv PG_ZERO 110e013216eSKip Macyflag set if it is zeroed. 1116484c361SAlfred Perlstein.El 112bf7f20c2SRuslan Ermilov.El 1136484c361SAlfred Perlstein.Sh RETURN VALUES 1142e693d19SChad DavidThe 1156484c361SAlfred Perlstein.Vt vm_page_t 1162e693d19SChad Davidthat was allocated is returned if successful; otherwise, 1176484c361SAlfred Perlstein.Dv NULL 1186484c361SAlfred Perlsteinis returned. 1196484c361SAlfred Perlstein.Sh NOTES 1206484c361SAlfred PerlsteinThe pager process is always upgraded to 1216484c361SAlfred Perlstein.Dv VM_ALLOC_SYSTEM 1226484c361SAlfred Perlsteinunless 1236484c361SAlfred Perlstein.Dv VM_ALLOC_INTERRUPT 1246484c361SAlfred Perlsteinis set. 1256484c361SAlfred Perlstein.Sh AUTHORS 126571dba6eSHiten PandyaThis manual page was written by 1278a7314fcSBaptiste Daroussin.An Chad David Aq Mt davidc@acns.ab.ca . 128