aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/linux/mempool.h3
-rw-r--r--mm/mempool.c2
2 files changed, 4 insertions, 1 deletions
diff --git a/include/linux/mempool.h b/include/linux/mempool.h
index b19b3023c880..69b6951e8fd2 100644
--- a/include/linux/mempool.h
+++ b/include/linux/mempool.h
@@ -36,7 +36,8 @@ extern void mempool_free(void *element, mempool_t *pool);
36 36
37/* 37/*
38 * A mempool_alloc_t and mempool_free_t that get the memory from 38 * A mempool_alloc_t and mempool_free_t that get the memory from
39 * a slab that is passed in through pool_data. 39 * a slab cache that is passed in through pool_data.
40 * Note: the slab cache may not have a ctor function.
40 */ 41 */
41void *mempool_alloc_slab(gfp_t gfp_mask, void *pool_data); 42void *mempool_alloc_slab(gfp_t gfp_mask, void *pool_data);
42void mempool_free_slab(void *element, void *pool_data); 43void mempool_free_slab(void *element, void *pool_data);
diff --git a/mm/mempool.c b/mm/mempool.c
index 949970db2874..b60fb85526ed 100644
--- a/mm/mempool.c
+++ b/mm/mempool.c
@@ -15,6 +15,7 @@
15#include <linux/mempool.h> 15#include <linux/mempool.h>
16#include <linux/blkdev.h> 16#include <linux/blkdev.h>
17#include <linux/writeback.h> 17#include <linux/writeback.h>
18#include "slab.h"
18 19
19static void add_element(mempool_t *pool, void *element) 20static void add_element(mempool_t *pool, void *element)
20{ 21{
@@ -334,6 +335,7 @@ EXPORT_SYMBOL(mempool_free);
334void *mempool_alloc_slab(gfp_t gfp_mask, void *pool_data) 335void *mempool_alloc_slab(gfp_t gfp_mask, void *pool_data)
335{ 336{
336 struct kmem_cache *mem = pool_data; 337 struct kmem_cache *mem = pool_data;
338 VM_BUG_ON(mem->ctor);
337 return kmem_cache_alloc(mem, gfp_mask); 339 return kmem_cache_alloc(mem, gfp_mask);
338} 340}
339EXPORT_SYMBOL(mempool_alloc_slab); 341EXPORT_SYMBOL(mempool_alloc_slab);