summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorDavid Rientjes <rientjes@google.com>2015-04-16 02:14:14 +0300
committerLinus Torvalds <torvalds@linux-foundation.org>2015-04-16 02:35:18 +0300
commite244c9e66f6197f55f6fbb2d5e70714e262cc595 (patch)
tree97c010b71008486c3ff66a81e7bcc0e957f0f826 /include
parentee1462458cb543bbcfd379176bbba0d4bd052b7f (diff)
downloadlinux-e244c9e66f6197f55f6fbb2d5e70714e262cc595.tar.xz
mm, mempool: disallow mempools based on slab caches with constructors
All occurrences of mempools based on slab caches with object constructors have been removed from the tree, so disallow creating them. We can only dereference mem->ctor in mm/mempool.c without including mm/slab.h in include/linux/mempool.h. So simply note the restriction, just like the comment restricting usage of __GFP_ZERO, and warn on kernels with CONFIG_DEBUG_VM() if such a mempool is allocated from. We don't want to incur this check on every element allocation, so use VM_BUG_ON(). Signed-off-by: David Rientjes <rientjes@google.com> Cc: Dave Kleikamp <shaggy@kernel.org> Cc: Christoph Hellwig <hch@lst.de> Cc: Sebastian Ott <sebott@linux.vnet.ibm.com> Cc: Mikulas Patocka <mpatocka@redhat.com> Cc: Catalin Marinas <catalin.marinas@arm.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'include')
-rw-r--r--include/linux/mempool.h3
1 files changed, 2 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);
/*
* A mempool_alloc_t and mempool_free_t that get the memory from
- * a slab that is passed in through pool_data.
+ * a slab cache that is passed in through pool_data.
+ * Note: the slab cache may not have a ctor function.
*/
void *mempool_alloc_slab(gfp_t gfp_mask, void *pool_data);
void mempool_free_slab(void *element, void *pool_data);