[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.

[[email protected]: Fix up reversed #ifdef]
Signed-off-by: Christoph Hellwig <[email protected]>
Signed-off-by: Pekka Enberg <[email protected]>
Cc: Christoph Lameter <[email protected]>
Cc: Al Viro <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
This commit is contained in:
Christoph Hellwig 2006-10-04 02:15:25 -07:00 • committed by Linus Torvalds
commit 1d2c8eea69
4 changed files with 31 additions and 17 deletions

View file

@ -11,7 +11,7 @@
*/
void *__kzalloc(size_t size, gfp_t flags)
{
void *ret = ____kmalloc(size, flags);
void *ret = kmalloc_track_caller(size, flags);
if (ret)
memset(ret, 0, size);
return ret;
@ -33,7 +33,7 @@ char *kstrdup(const char *s, gfp_t gfp)
return NULL;
len = strlen(s) + 1;
buf = ____kmalloc(len, gfp);
buf = kmalloc_track_caller(len, gfp);
if (buf)
memcpy(buf, s, len);
return buf;
@ -51,7 +51,7 @@ void *kmemdup(const void *src, size_t len, gfp_t gfp)
{
void *p;
p = ____kmalloc(len, gfp);
p = kmalloc_track_caller(len, gfp);
if (p)
memcpy(p, src, len);
return p;