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

# mempool\_alloc(9)

allocate an element from a specific memory pool

## NAME

mempool\_alloc - allocate an element from a specific memory pool

## SYNOPSIS

**void \* mempool\_alloc(mempool\_t \*** *pool***, gfp\_t** *gfp\_mask***);**

## ARGUMENTS

*pool*

pointer to the memory pool which was allocated via **mempool\_create**.

*gfp\_mask*

the usual allocation bitmask.

## DESCRIPTION

this function only sleeps if the **alloc\_fn** function sleeps or returns NULL. Note that due to preallocation, this function \*never\* fails when called from process contexts. (it might fail if called from an IRQ context.)

## NOTE

using \_\_GFP\_ZERO is not supported.

## COPYRIGHT
