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

# alloc\_contig\_range(9)

\- tries to allocate given range of pages

## NAME

alloc\_contig\_range - - tries to allocate given range of pages

## SYNOPSIS

**int alloc\_contig\_range(unsigned long** *start***, unsigned long** *end***, unsigned** *migratetype***);**

## ARGUMENTS

*start*

start PFN to allocate

*end*

one-past-the-last PFN to allocate

*migratetype*

migratetype of the underlaying pageblocks (either #MIGRATE\_MOVABLE or #MIGRATE\_CMA). All pageblocks in range must have the same migratetype and it must be either of the two.

## DESCRIPTION

The PFN range does not have to be pageblock or MAX\_ORDER\_NR\_PAGES aligned, however it's the caller's responsibility to guarantee that we are the only thread that changes migrate type of pageblocks the pages fall in.

The PFN range must belong to a single zone.

Returns zero on success or negative error code. On success all pages which PFN is in \[start, end) are allocated for the caller and need to be freed with **free\_contig\_range**.

## COPYRIGHT
