---
name: "vm_page_grab"
section: "9"
platform: "freebsd"
package: "base"
version: "16.0-CURRENT-20261027-61c70dc16a79"
release: "FreeBSD 16.0-CURRENT (2026-10-27)"
platforms: ["linux", "freebsd"]
url: "https://new.carta.tech/vm_page_grab"
---

# vm\_page\_grab(9)

returns a page from an object

## NAME

**vm\_page\_grab** – returns a page from an object

## SYNOPSIS

**#include \<sys/param.h\>**

**#include \<vm/vm.h\>**

**#include \<vm/vm\_page.h\>**

*vm\_page\_t*\

**vm\_page\_grab**(*vm\_object\_t object*, *vm\_pindex\_t pindex*, *int allocflags*);

## DESCRIPTION

The **vm\_page\_grab**() function returns the page at *pindex* from the given object. If the page exists and is busy, **vm\_page\_grab**() will sleep while waiting for it. If the page does not exist, it is allocated. The function sleeps until the allocation request can be satisfied.

The function requires the *object* to be locked on entry, and returns with the object locked. If the **vm\_page\_grab**() function sleeps for any reason, the object lock is temporary dropped.

The **vm\_page\_grab**() supports all of the flags supported by [vm\_page\_alloc(9)](/vm_page_alloc/9.md). In addition, **vm\_page\_grab**() supports the following flags:

- VM\_ALLOC\_IGN\_SBUSY

  When waiting for the busy state of the existing page to drain, only test for exclusive busy; ignore the shared busy counter.

## RETURN VALUES

The **vm\_page\_grab**() always returns the page.

## SEE ALSO

[vm\_page\_alloc(9)](/vm_page_alloc/9.md)

## AUTHORS

This manual page was written by Chad David ⟨*davidc@acns.ab.ca*⟩.
