[lkml]   [2007]   [Sep]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: [PATCH] Uninline kcalloc()
On Sep 24, 2007, at 01:35:08, wrote:
> On Sun, 23 Sep 2007 00:03:49 +0400, Alexey Dobriyan said:
>> -static inline void *kcalloc(size_t n, size_t size, gfp_t flags)
>> -{
>> - if (n != 0 && size > ULONG_MAX / n)
>> - return NULL;
>> - return __kmalloc(n * size, flags | __GFP_ZERO);
>> -}
>> +void *kcalloc(size_t n, size_t size, gfp_t flags);
> NAK.
> This busticates some pretty subtle code in mm/slab.c that uses uses
> __builtin_return_address() for debugging - if you do this, then the
> "calling function" gets listed as "kcalloc()" rather than the much
> more useful "function that called kcalloc()" (which is what you
> care about).
> (I remember going around and around multiple times getting those
> stupid inlines set up right, so that feature actually did something
> useful, otherwise kcalloc and kzalloc didn't report where they were
> called from).

Proper fix is to give __kmalloc a "void *caller" parameter and have
all of the various wrapper functions pass in the value of
__builtin_return_address() appropriately. I believe that even works
properly for inline functions which may or may not be inlined.

Kyle Moffett

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
More majordomo info at
Please read the FAQ at

 \ /
  Last update: 2007-09-24 15:03    [W:0.073 / U:3.364 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site