Re: [-mm patch] make kcalloc() a static inline

From: Adrian Bunk
Date: Mon Aug 15 2005 - 11:31:05 EST


On Mon, Aug 15, 2005 at 04:06:22PM +0300, Pekka J Enberg wrote:
> On Mon, 2005-08-15 at 15:17 +0300, Denis Vlasenko wrote:
> > > Seems like that optimization is not helping.
> > > Do you have better example?
>
> On Mon, 15 Aug 2005, Arjan van de Ven wrote:
> > you need gcc 4.1 (eg CVS) for the value range propagation stuff.
>
> For Denis' example, it does not seem to help. I must admit I did not know
> GCC 3.x does not have this optimization. I am also bit confused as Adrian
> and I saw small reduction in kernel text with kcalloc() inlined. If GCC
> is, in fact, spreading the extra operations everywhere, shouldn't kernel
> text be bigger?

Denis' example is a case where gcc might not produce the best code
possible, but anyway his example isn't the typical in-kernel example.

In most in-kernel cases the first two arguments of kcalloc() are
constant at compile-time - and in these cases all gcc versions supported
by the kernel are able to optimize away the checks.

> Pekka
>...

cu
Adrian

--

"Is there not promise of rain?" Ling Tan asked suddenly out
of the darkness. There had been need of rain for many days.
"Only a promise," Lao Er said.
Pearl S. Buck - Dragon Seed

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