Re: [PATCH] kernel: use kcalloc instead kmalloc/memset

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



At Mon, 8 Aug 2005 23:05:24 +0200,
Adrian Bunk wrote:
> 
> On Mon, Aug 08, 2005 at 12:11:21PM +0200, Takashi Iwai wrote:
> > At Sat, 6 Aug 2005 17:09:40 +0200,
> > Adrian Bunk wrote:
> > > 
> > > 
> > > Looking at how few is left from kcalloc, can't we make it a
> > > "static inline" function in slab.h?
> > > 
> > > This would optimize nicely for all of the users where the first or even 
> > > the first two parameters are constant at compile-time and shouldn't do 
> > > much harm for the other users.
> > > 
> > > As a side effect, the difference between kcalloc(1, ...) and kzalloc() 
> > > would become a coding style question without any effect on the generated 
> > > code.
> > 
> > How about to use __builtin_constant_p() like kmalloc?
> > The code readability would be worsen, though...
> 
> Where should this make any difference?
> 
> If the function is "static inline", gcc can e.g. always determine at 
> compile-time that 1 >= 0 can never be false and therefore optimize it 
> away.

Argh, forget my post.  It was just lack of caffeine :)


Takashi
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]
  Powered by Linux