diff options
author | Catalin Marinas <catalin.marinas@arm.com> | 2009-10-28 09:33:08 -0400 |
---|---|---|
committer | Catalin Marinas <catalin.marinas@arm.com> | 2009-10-28 09:33:08 -0400 |
commit | e7cb55b946a2182c347047dc903c6ed0daef100c (patch) | |
tree | 28cc01bd513418a4917358b748481d3a31f69ab1 | |
parent | 012abeea669ea49636cf952d13298bb68654146a (diff) |
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>
-rw-r--r-- | mm/slab.c | 6 |
1 files changed, 4 insertions, 2 deletions
@@ -2261,9 +2261,11 @@ kmem_cache_create (const char *name, size_t size, size_t align, | |||
2261 | /* | 2261 | /* |
2262 | * Determine if the slab management is 'on' or 'off' slab. | 2262 | * Determine if the slab management is 'on' or 'off' slab. |
2263 | * (bootstrapping cannot cope with offslab caches so don't do | 2263 | * (bootstrapping cannot cope with offslab caches so don't do |
2264 | * it too early on.) | 2264 | * it too early on. Always use on-slab management when |
2265 | * SLAB_NOLEAKTRACE to avoid recursive calls into kmemleak) | ||
2265 | */ | 2266 | */ |
2266 | if ((size >= (PAGE_SIZE >> 3)) && !slab_early_init) | 2267 | if ((size >= (PAGE_SIZE >> 3)) && !slab_early_init && |
2268 | !(flags & SLAB_NOLEAKTRACE)) | ||
2267 | /* | 2269 | /* |
2268 | * Size is large, assume best to place the slab management obj | 2270 | * Size is large, assume best to place the slab management obj |
2269 | * off-slab (should allow better packing of objs). | 2271 | * off-slab (should allow better packing of objs). |