---
name: "find_or_create_page"
section: "9"
platform: "linux"
package: "linux-manual-3.2"
version: "3.2.78-1"
release: "Debian 7 (Wheezy)"
platforms: ["linux"]
url: "https://new.carta.tech/find_or_create_page"
---

# find\_or\_create\_page(9)

locate or add a pagecache page

## NAME

find\_or\_create\_page - locate or add a pagecache page

## SYNOPSIS

**struct page \* find\_or\_create\_page(struct address\_space \*** *mapping***, pgoff\_t** *index***, gfp\_t** *gfp\_mask***);**

## ARGUMENTS

*mapping*

the page's address\_space

*index*

the page's index into the mapping

*gfp\_mask*

page allocation mode

## DESCRIPTION

Locates a page in the pagecache. If the page is not present, a new page is allocated using *gfp\_mask* and is added to the pagecache and to the VM's LRU list. The returned page is locked and has its reference count incremented.

**find\_or\_create\_page** may sleep, even if *gfp\_flags* specifies an atomic allocation!

**find\_or\_create\_page** returns the desired page's address, or zero on memory exhaustion.

## COPYRIGHT
