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

# bitmap\_find\_free\_region(9)

find a contiguous aligned mem region

## NAME

bitmap\_find\_free\_region - find a contiguous aligned mem region

## SYNOPSIS

**int bitmap\_find\_free\_region(unsigned long \*** *bitmap***, unsigned int** *bits***, int** *order***);**

## ARGUMENTS

*bitmap*

array of unsigned longs corresponding to the bitmap

*bits*

number of bits in the bitmap

*order*

region size (log base 2 of number of bits) to find

## DESCRIPTION

Find a region of free (zero) bits in a *bitmap* of *bits* bits and allocate them (set them to one). Only consider regions of length a power (*order*) of two, aligned to that power of two, which makes the search algorithm much faster.

Return the bit offset in bitmap of the allocated region, or -errno on failure.

## COPYRIGHT
