Re: -rc3 leaking NOT BIO [Was: Memory leak in 2.6.11-rc1?]

From: Linus Torvalds
Date: Thu Feb 17 2005 - 13:21:50 EST




On Thu, 17 Feb 2005, Parag Warudkar wrote:
>
> A question - is it safe to assume it is a kmalloc based leak? (I am thinking
> of tracking it down by using kprobes to insert a probe into __kmalloc and
> record the stack to see what is causing so many allocations.)

It's definitely kmalloc-based, but you may not catch it in __kmalloc. The
"kmalloc()" function is actually an inline function which has some magic
compile-time code that statically determines when the size is constant and
can be turned into a direct call to "kmem_cache_alloc()" with the proper
cache descriptor.

So you'd need to either instrument kmem_cache_alloc() (and trigger on the
proper slab descriptor) or you would need to modify the kmalloc()
definition in <linux/slab.h> to not do the constant size optimization, at
which point you can instrument just __kmalloc() and avoid some of the
overhead.

Linus
-
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/