---
name: "vm_map_ram"
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_map_ram"
---

# vm\_map\_ram(9)

map pages linearly into kernel virtual address (vmalloc space)

## NAME

vm\_map\_ram - map pages linearly into kernel virtual address (vmalloc space)

## SYNOPSIS

**void \* vm\_map\_ram(struct page \*\*** *pages***, unsigned int** *count***, int** *node***, pgprot\_t** *prot***);**

## ARGUMENTS

*pages*

an array of pointers to the pages to be mapped

*count*

number of pages

*node*

prefer to allocate data structures on this node

*prot*

memory protection to use. PAGE\_KERNEL for regular RAM

## DESCRIPTION

If you use this function for less than VMAP\_MAX\_ALLOC pages, it could be faster than vmap so it's good. But if you mix long-life and short-life objects with **vm\_map\_ram**, it could consume lots of address space through fragmentation (especially on a 32bit machine). You could see failures in the end. Please use this function for short-lived objects.

## RETURN

a pointer to the address that has been mapped, or **NULL** on failure

## COPYRIGHT
