diff options
author | Matthew Dobson <colpatch@us.ibm.com> | 2006-03-26 01:37:49 -0800 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-03-26 08:57:00 -0800 |
commit | fec433aaaae32a02329ad7d71b0f3c91b7525077 (patch) | |
tree | cb8b700fa5c0e4ae51545bf2fbcaa37fc6bd6392 /include/linux/mempool.h | |
parent | 26b6e051bc36b968a0b5ac96903b99e050d20b87 (diff) | |
download | linux-stable-fec433aaaae32a02329ad7d71b0f3c91b7525077.tar.gz linux-stable-fec433aaaae32a02329ad7d71b0f3c91b7525077.tar.bz2 linux-stable-fec433aaaae32a02329ad7d71b0f3c91b7525077.zip |
[PATCH] mempool: add mempool_create_slab_pool()
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>
Diffstat (limited to 'include/linux/mempool.h')
-rw-r--r-- | include/linux/mempool.h | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/include/linux/mempool.h b/include/linux/mempool.h index 41570ce353eb..9be484d11283 100644 --- a/include/linux/mempool.h +++ b/include/linux/mempool.h @@ -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); @@ -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 |