summaryrefslogtreecommitdiffstats
path: root/mm
diff options
context:
space:
mode:
authorCatalin Marinas <catalin.marinas@arm.com>2009-10-28 13:33:08 +0000
committerCatalin Marinas <catalin.marinas@arm.com>2009-10-28 13:33:08 +0000
commite7cb55b946a2182c347047dc903c6ed0daef100c (patch)
tree28cc01bd513418a4917358b748481d3a31f69ab1 /mm
parent012abeea669ea49636cf952d13298bb68654146a (diff)
downloadlinux-e7cb55b946a2182c347047dc903c6ed0daef100c.tar.gz
linux-e7cb55b946a2182c347047dc903c6ed0daef100c.tar.bz2
linux-e7cb55b946a2182c347047dc903c6ed0daef100c.zip
kmemleak: Do not use off-slab management with SLAB_NOLEAKTRACE
With the slab allocator, if off-slab management is enabled for the kmem_caches used by kmemleak, it leads to recursive calls into kmemleak_alloc(). Off-slab management can be triggered by other config options increasing the slab size, e.g. DEBUG_PAGEALLOC. Reported-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp> Reviewed-by: Pekka Enberg <penberg@cs.helsinki.fi> Cc: Christoph Lameter <cl@linux-foundation.org> Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
Diffstat (limited to 'mm')
-rw-r--r--mm/slab.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/mm/slab.c b/mm/slab.c
index 7dfa481c96ba..646db3085193 100644
--- a/mm/slab.c
+++ b/mm/slab.c
@@ -2261,9 +2261,11 @@ kmem_cache_create (const char *name, size_t size, size_t align,
/*
* Determine if the slab management is 'on' or 'off' slab.
* (bootstrapping cannot cope with offslab caches so don't do
- * it too early on.)
+ * it too early on. Always use on-slab management when
+ * SLAB_NOLEAKTRACE to avoid recursive calls into kmemleak)
*/
- if ((size >= (PAGE_SIZE >> 3)) && !slab_early_init)
+ if ((size >= (PAGE_SIZE >> 3)) && !slab_early_init &&
+ !(flags & SLAB_NOLEAKTRACE))
/*
* Size is large, assume best to place the slab management obj
* off-slab (should allow better packing of objs).