---
name: "vm_insert_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/vm_insert_page"
---

# vm\_insert\_page(9)

insert single page into user vma

## NAME

vm\_insert\_page - insert single page into user vma

## SYNOPSIS

**int vm\_insert\_page(struct vm\_area\_struct \*** *vma***, unsigned long** *addr***, struct page \*** *page***);**

## ARGUMENTS

*vma*

user vma to map to

*addr*

target user address of this page

*page*

source kernel page

## DESCRIPTION

This allows drivers to insert individual pages they've allocated into a user vma.

The page has to be a nice clean \_individual\_ kernel allocation. If you allocate a compound page, you need to have marked it as such (\_\_GFP\_COMP), or manually just split the page up yourself (see **split\_page**).

NOTE! Traditionally this was done with “**remap\_pfn\_range**” which took an arbitrary page protection parameter. This doesn't allow that. Your vma protection will have to be set up correctly, which means that if you want a shared writable mapping, you'd better ask for a shared writable mapping!

The page does not need to be reserved.

Usually this function is called from f\_op-\>**mmap** handler under mm-\>mmap\_sem write-lock, so it can change vma-\>vm\_flags. Caller must set VM\_MIXEDMAP on vma if it wants to call this function from other places, for example from page-fault handler.

## COPYRIGHT
