Commit fec433aa authored by Matthew Dobson's avatar Matthew Dobson Committed by Linus Torvalds

[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: default avatarMatthew Dobson <colpatch@us.ibm.com>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 26b6e051
...@@ -6,6 +6,8 @@ ...@@ -6,6 +6,8 @@
#include <linux/wait.h> #include <linux/wait.h>
struct kmem_cache;
typedef void * (mempool_alloc_t)(gfp_t gfp_mask, void *pool_data); typedef void * (mempool_alloc_t)(gfp_t gfp_mask, void *pool_data);
typedef void (mempool_free_t)(void *element, 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); ...@@ -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_alloc_slab(gfp_t gfp_mask, void *pool_data);
void mempool_free_slab(void *element, 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 * 2 mempool_alloc_t's and a mempool_free_t to kmalloc/kzalloc and kfree
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment