Re: [PATCH]micro optimization of kcalloc
From: Valdis . Kletnieks
Date: Wed Mar 22 2006 - 00:42:04 EST
On Mon, 20 Mar 2006 10:44:00 PST, David Lang said:
> On Mon, 20 Mar 2006, Pekka Enberg wrote:
> > On Mon, Mar 20, 2006 at 03:45:23PM +0100, Oliver Neukum wrote:
> >>> static inline void *kcalloc(size_t n, size_t size, gfp_t flags)
> > On 3/20/06, Benjamin LaHaise <bcrl@xxxxxxxxx> wrote:
> >> This function shouldn't be inlined. We have no need to optimize the
> >> unlikely case like this.
> >
> > IIRC, I made it static inline in the first place because that actually
> > reduced kernel text size. (And I think it was Adrian who made me do it
> > :-).
>
> I wonder if this is still needed with the new inline changes that were
> made to allow GCC to make the decision (for recent GCC's)
One non-obvious reason to inline it (at least in -mm kernels) is because the
slab leak detector stuff wants to find where it was called from - and if you
don't inline kcalloc(), you end up with the kzalloc() call it makes showing
kcalloc() as the caller. If you inline it, you end up showing the caller
of kcalloc() instead, which is far more useful.....
Attachment:
pgp00000.pgp
Description: PGP signature