Skip to content

Commit

Permalink
[PATCH] mempool: add mempool_create_slab_pool()
Browse files Browse the repository at this point in the history
Create a simple wrapper function for the common case of creating a slab-based
mempool.

Signed-off-by: Matthew Dobson <colpatch@us.ibm.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
  • Loading branch information
Matthew Dobson authored and Linus Torvalds committed Mar 26, 2006
1 parent 26b6e05 commit fec433a
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions include/linux/mempool.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@

#include <linux/wait.h>

struct kmem_cache;

typedef void * (mempool_alloc_t)(gfp_t gfp_mask, void *pool_data);
typedef void (mempool_free_t)(void *element, void *pool_data);

Expand Down Expand Up @@ -37,6 +39,12 @@ extern 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);
static inline mempool_t *
mempool_create_slab_pool(int min_nr, struct kmem_cache *kc)
{
return mempool_create(min_nr, mempool_alloc_slab, mempool_free_slab,
(void *) kc);
}

/*
* 2 mempool_alloc_t's and a mempool_free_t to kmalloc/kzalloc and kfree
Expand Down

0 comments on commit fec433a

Please sign in to comment.