---
name: "replace_page_cache_page"
section: "9"
platform: "linux"
package: "linux-manual-4.9"
version: "4.9.228-1"
release: "Debian 9 (Stretch)"
platforms: ["linux"]
url: "https://new.carta.tech/replace_page_cache_page"
---

# replace\_page\_cache\_page(9)

replace a pagecache page with a new one

## NAME

replace\_page\_cache\_page - replace a pagecache page with a new one

## SYNOPSIS

**int replace\_page\_cache\_page(struct page \*** *old***, struct page \*** *new***, gfp\_t** *gfp\_mask***);**

## ARGUMENTS

*old*

page to be replaced

*new*

page to replace with

*gfp\_mask*

allocation mode

## DESCRIPTION

This function replaces a page in the pagecache with a new one. On success it acquires the pagecache reference for the new page and drops it for the old page. Both the old and new pages must be locked. This function does not add the new page to the LRU, the caller must do that.

The remove + add is atomic. The only way this function can fail is memory allocation failure.

## COPYRIGHT
