plain text document attachment
(mempool-add_mempool_create_slab_pool.patch)
Create a simple wrapper function for the common case of creating a slab-based
mempool.
Signed-off-by: Matthew Dobson <[email protected]>
include/linux/mempool.h | 5 +++++
1 files changed, 5 insertions(+)
Index: linux-2.6.16-rc1-mm4+mempool_work/include/linux/mempool.h
===================================================================
--- linux-2.6.16-rc1-mm4+mempool_work.orig/include/linux/mempool.h
+++ linux-2.6.16-rc1-mm4+mempool_work/include/linux/mempool.h
@@ -37,6 +37,11 @@ extern void mempool_free(void *element,
*/
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, kmem_cache_t *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
--