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

# idr\_alloc\_cyclic(9)

allocate new idr entry in a cyclical fashion

## NAME

idr\_alloc\_cyclic - allocate new idr entry in a cyclical fashion

## SYNOPSIS

**int idr\_alloc\_cyclic(struct idr \*** *idr***, void \*** *ptr***, int** *start***, int** *end***, gfp\_t** *gfp\_mask***);**

## ARGUMENTS

*idr*

the (initialized) idr

*ptr*

pointer to be associated with the new id

*start*

the minimum id (inclusive)

*end*

the maximum id (exclusive, \<= 0 for max)

*gfp\_mask*

memory allocation flags

## DESCRIPTION

Essentially the same as idr\_alloc, but prefers to allocate progressively higher ids if it can. If the “cur” counter wraps, then it will start again at the “start” end of the range and allocate one that has already been used.

## COPYRIGHT
