Re: [PATCH] kmemleak: Do not use off-slab management withSLAB_NOLEAKTRACE

From: Catalin Marinas
Date: Fri Oct 16 2009 - 08:10:47 EST


Hi Pekka,

On Thu, 2009-10-15 at 21:59 +0300, Pekka Enberg wrote:
> Catalin Marinas wrote:
> > 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@xxxxxxxxxxxxxxxxxxx>
> > Cc: Pekka Enberg <penberg@xxxxxxxxxxxxxx>
> > Cc: Christoph Lameter <cl@xxxxxxxxxxxxxxxxxxxx>
> > Signed-off-by: Catalin Marinas <catalin.marinas@xxxxxxx>
>
> Forcing slabs to use on-slab management is pretty bad from memory
> consumption point of view. Wouldn't it be better to annotate the
> recursive calls somehow?

The are annotated using SLAB_NOLEAKTRACE but off-slab management uses a
general cachep and we cannot use this flag on them as we end up ignoring
kmalloc allocations. An alternative is to use GFP_ flag rather than a
SLAB_ one to track the recursive calls.

I could also rework the way hooks were added to slab.c but currently
they follow the same places as kmemcheck_slab_alloc and
lockdep_trace_alloc.

Anyway, the kmemleak caches only need off-slab management when
DEBUG_PAGEALLOC is enabled but in this case the memory consumption is
high anyway.

--
Catalin

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/