Linux Kernel
3.7.1
|
#include <linux/wait.h>
Go to the source code of this file.
Data Structures | |
struct | mempool_s |
Typedefs | |
typedef void *( | mempool_alloc_t )(gfp_t gfp_mask, void *pool_data) |
typedef void( | mempool_free_t )(void *element, void *pool_data) |
typedef struct mempool_s | mempool_t |
Functions | |
mempool_t * | mempool_create (int min_nr, mempool_alloc_t *alloc_fn, mempool_free_t *free_fn, void *pool_data) |
mempool_t * | mempool_create_node (int min_nr, mempool_alloc_t *alloc_fn, mempool_free_t *free_fn, void *pool_data, gfp_t gfp_mask, int nid) |
int | mempool_resize (mempool_t *pool, int new_min_nr, gfp_t gfp_mask) |
void | mempool_destroy (mempool_t *pool) |
void * | mempool_alloc (mempool_t *pool, gfp_t gfp_mask) |
void | mempool_free (void *element, mempool_t *pool) |
void * | mempool_alloc_slab (gfp_t gfp_mask, void *pool_data) |
void | mempool_free_slab (void *element, void *pool_data) |
void * | mempool_kmalloc (gfp_t gfp_mask, void *pool_data) |
void | mempool_kfree (void *element, void *pool_data) |
void * | mempool_alloc_pages (gfp_t gfp_mask, void *pool_data) |
void | mempool_free_pages (void *element, void *pool_data) |
mempool_alloc - allocate an element from a specific memory pool : pointer to the memory pool which was allocated via mempool_create(). : the usual allocation bitmask.
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.)
mempool_t* mempool_create | ( | int | min_nr, |
mempool_alloc_t * | alloc_fn, | ||
mempool_free_t * | free_fn, | ||
void * | pool_data | ||
) |
mempool_create - create a memory pool : the minimum number of elements guaranteed to be allocated for this pool. : user-defined element-allocation function. : user-defined element-freeing function. : optional private data available to the user-defined functions.
this function creates and allocates a guaranteed size, preallocated memory pool. The pool can be used from the mempool_alloc() and mempool_free() functions. This function might sleep. Both the alloc_fn() and the free_fn() functions might sleep - as long as the mempool_alloc() function is not called from IRQ contexts.
mempool_t* mempool_create_node | ( | int | min_nr, |
mempool_alloc_t * | alloc_fn, | ||
mempool_free_t * | free_fn, | ||
void * | pool_data, | ||
gfp_t | gfp_mask, | ||
int | nid | ||
) |
mempool_resize - resize an existing memory pool : pointer to the memory pool which was allocated via mempool_create(). : the new minimum number of elements guaranteed to be allocated for this pool. : the usual allocation bitmask.
This function shrinks/grows the pool. In the case of growing, it cannot be guaranteed that the pool will be grown to the new size immediately, but new mempool_free() calls will refill it.
Note, the caller must guarantee that no mempool_destroy is called while this function is running. mempool_alloc() & mempool_free() might be called (eg. from IRQ contexts) while this function executes.