[PATCH] slab: clean up leak tracking ifdefs a little bit
- rename ____kmalloc to kmalloc_track_caller so that people have a chance to guess what it does just from it's name. Add a comment describing it for those who don't. Also move it after kmalloc in slab.h so people get less confused when they are just looking for kmalloc - move things around in slab.c a little to reduce the ifdef mess. [penberg@cs.helsinki.fi: Fix up reversed #ifdef] Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Pekka Enberg <penberg@cs.helsinki.fi> Cc: Christoph Lameter <clameter@engr.sgi.com> Cc: Al Viro <viro@zeniv.linux.org.uk> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
This commit is contained in:
committed by
Linus Torvalds
parent
88ca3b94e8
commit
1d2c8eea69
13
mm/slab.c
13
mm/slab.c
@@ -3488,22 +3488,25 @@ static __always_inline void *__do_kmalloc(size_t size, gfp_t flags,
|
||||
}
|
||||
|
||||
|
||||
#ifdef CONFIG_DEBUG_SLAB
|
||||
void *__kmalloc(size_t size, gfp_t flags)
|
||||
{
|
||||
#ifndef CONFIG_DEBUG_SLAB
|
||||
return __do_kmalloc(size, flags, NULL);
|
||||
#else
|
||||
return __do_kmalloc(size, flags, __builtin_return_address(0));
|
||||
#endif
|
||||
}
|
||||
EXPORT_SYMBOL(__kmalloc);
|
||||
|
||||
#ifdef CONFIG_DEBUG_SLAB
|
||||
void *__kmalloc_track_caller(size_t size, gfp_t flags, void *caller)
|
||||
{
|
||||
return __do_kmalloc(size, flags, caller);
|
||||
}
|
||||
EXPORT_SYMBOL(__kmalloc_track_caller);
|
||||
|
||||
#else
|
||||
void *__kmalloc(size_t size, gfp_t flags)
|
||||
{
|
||||
return __do_kmalloc(size, flags, NULL);
|
||||
}
|
||||
EXPORT_SYMBOL(__kmalloc);
|
||||
#endif
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user