Re: RFC: turn kmalloc+memset(,0,) into kcalloc

2005-04-09 Thread Paul Jackson
Paulo wrote: > In the first case you have to read carefully to make sure that the size > argument in both the kmalloc and the memset are the same. If that were the only concern (which it isn't, and I don't pretend to be addressing the other concerns on this thread) then pulling out the common sub

Re: RFC: turn kmalloc+memset(,0,) into kcalloc

2005-04-08 Thread Jesper Juhl
On Wed, 6 Apr 2005, Jörn Engel wrote: > On Tue, 5 April 2005 22:01:49 +0200, Jesper Juhl wrote: > > On Tue, 5 Apr 2005, Roland Dreier wrote: > > > > > > or simply > > > > if (!(ptr = kcalloc(n, size, ...))) > > > > goto out; > > > > and save an additional line of s

Re: RFC: turn kmalloc+memset(,0,) into kcalloc

2005-04-08 Thread Randy.Dunlap
On Fri, 8 Apr 2005 21:43:55 +0200 Adrian Bunk wrote: | On Fri, Apr 08, 2005 at 05:24:42PM +0100, Paulo Marques wrote: | > Adrian Bunk wrote: | > >[...] | > >>>On Tue, Apr 05, 2005 at 05:26:31PM +0100, Paulo Marques wrote: | > >> | > >>Hi Adrian, | > > | >... | > >Joerg's list of recursions should

Re: RFC: turn kmalloc+memset(,0,) into kcalloc

2005-04-08 Thread Adrian Bunk
On Fri, Apr 08, 2005 at 05:24:42PM +0100, Paulo Marques wrote: > Adrian Bunk wrote: > >[...] > >>>On Tue, Apr 05, 2005 at 05:26:31PM +0100, Paulo Marques wrote: > >> > >>Hi Adrian, > > > >Hi Paolo, > > Paulo, please :) >... The second name I got wrong today... Sorry. >... > >Joerg's list of rec

Re: RFC: turn kmalloc+memset(,0,) into kcalloc

2005-04-08 Thread Paulo Marques
Adrian Bunk wrote: [...] On Tue, Apr 05, 2005 at 05:26:31PM +0100, Paulo Marques wrote: Hi Adrian, Hi Paolo, Paulo, please :) Paolo is Spanish (or Italian), whereas Paulo is a Portuguese name. [...] I think most will agree that the second piece of code is more "readable". In this case yes (but it c

Re: RFC: turn kmalloc+memset(,0,) into kcalloc

2005-04-08 Thread Adrian Bunk
On Fri, Apr 08, 2005 at 03:20:52PM +0200, Jörn Engel wrote: > On Fri, 8 April 2005 15:00:08 +0200, Adrian Bunk wrote: > > > > Joerg's > > Please! ;) Ups, sorry... > Jörn cu Adrian -- "Is there not promise of rain?" Ling Tan asked suddenly out of the darkness. There had been

Re: RFC: turn kmalloc+memset(,0,) into kcalloc

2005-04-08 Thread Jörn Engel
On Fri, 8 April 2005 15:00:08 +0200, Adrian Bunk wrote: > > Joerg's Please! ;) Jörn -- It's just what we asked for, but not what we want! -- anonymous - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at

Re: RFC: turn kmalloc+memset(,0,) into kcalloc

2005-04-08 Thread Adrian Bunk
On Fri, Apr 08, 2005 at 01:38:22PM +0100, Paulo Marques wrote: > Adrian Bunk wrote: > >On Tue, Apr 05, 2005 at 05:26:31PM +0100, Paulo Marques wrote: > > Hi Adrian, Hi Paolo, > >>[...] > >>pros: > >> - smaller kernel image size > >> - smaller (and more readable) source code > > > >Which is bette

stack checking (was: Re: RFC: turn kmalloc+memset(,0,) into kcalloc)

2005-04-08 Thread Jörn Engel
On Fri, 8 April 2005 13:38:22 +0100, Paulo Marques wrote: > Adrian Bunk wrote: > > >E.g. read my "Stack usage tasks" email. The benefits would only be > >present for people using GNU gcc 3.4 or SuSE gcc 3.3 on i386, but this > >is a reasonable subset of the kernel users - and it brings them a >

Re: RFC: turn kmalloc+memset(,0,) into kcalloc

2005-04-08 Thread Paulo Marques
Adrian Bunk wrote: On Tue, Apr 05, 2005 at 05:26:31PM +0100, Paulo Marques wrote: [...] Hi Paulo, Hi Adrian, [...] pros: - smaller kernel image size - smaller (and more readable) source code Which is better readable depends on what you are used to. That's true to some degree, but look at code lik

Re: RFC: turn kmalloc+memset(,0,) into kcalloc

2005-04-07 Thread Kyle Moffett
On Apr 06, 2005, at 11:50, Paulo Marques wrote: kzalloc it is, then. [...] So we gain 8kB on the uncompressed image and 1347 bytes on the compressed one. This was just a dumb test and actual results might be better due to smarter human cleanups. Not a spectacular gain per se, but the increase in

Re: RFC: turn kmalloc+memset(,0,) into kcalloc

2005-04-07 Thread Adrian Bunk
On Tue, Apr 05, 2005 at 05:26:31PM +0100, Paulo Marques wrote: > > Hi, Hi Paulo, > I noticed there are a number of places in the kernel that do: > > ptr = kmalloc(n * size, ...) > if (!ptr) > goto out; > memset(ptr, 0, n * size); > > It seems that these could be

Re: RFC: turn kmalloc+memset(,0,) into kcalloc

2005-04-06 Thread Paulo Marques
Pekka Enberg wrote: Hi, On Apr 6, 2005 3:15 PM, Paulo Marques <[EMAIL PROTECTED]> wrote: However "calloc" is the standard C interface for doing this, so it makes some sense to use it here as well... :( I initally submitted kcalloc() with just one parameter but Arjan wanted it to be similar to stan

Re: RFC: turn kmalloc+memset(,0,) into kcalloc

2005-04-06 Thread Pekka Enberg
Hi, On Apr 6, 2005 3:15 PM, Paulo Marques <[EMAIL PROTECTED]> wrote: > However "calloc" is the standard C interface for doing this, so it makes > some sense to use it here as well... :( I initally submitted kcalloc() with just one parameter but Arjan wanted it to be similar to standard calloc() s

Re: RFC: turn kmalloc+memset(,0,) into kcalloc

2005-04-06 Thread Paulo Marques
Jörn Engel wrote: On Tue, 5 April 2005 22:01:49 +0200, Jesper Juhl wrote: On Tue, 5 Apr 2005, Roland Dreier wrote: > or simply > if (!(ptr = kcalloc(n, size, ...))) > goto out; > and save an additional line of screen realestate while you are at it... No, please

Re: RFC: turn kmalloc+memset(,0,) into kcalloc

2005-04-06 Thread Denis Vlasenko
On Tuesday 05 April 2005 21:00, Jörn Engel wrote: > On Tue, 5 April 2005 17:26:31 +0100, Paulo Marques wrote: > > > > Would this be a good thing to clean up, or isn't it worth the effort at all? > > I would welcome such a stream of patches. But in spite of the calloc > interface being rather stu

Re: RFC: turn kmalloc+memset(,0,) into kcalloc

2005-04-06 Thread Jörn Engel
On Tue, 5 April 2005 22:01:49 +0200, Jesper Juhl wrote: > On Tue, 5 Apr 2005, Roland Dreier wrote: > > > > or simply > > > if (!(ptr = kcalloc(n, size, ...))) > > > goto out; > > > and save an additional line of screen realestate while you are at > > it... > >

Re: RFC: turn kmalloc+memset(,0,) into kcalloc

2005-04-05 Thread Jesper Juhl
On Tue, 5 Apr 2005, Roland Dreier wrote: > > or simply > > if (!(ptr = kcalloc(n, size, ...))) > > goto out; > > and save an additional line of screen realestate while you are at it... > > No, please don't do that. The general kernel style is to avoid > as

Re: RFC: turn kmalloc+memset(,0,) into kcalloc

2005-04-05 Thread Roland Dreier
> or simply > if (!(ptr = kcalloc(n, size, ...))) > goto out; > and save an additional line of screen realestate while you are at it... No, please don't do that. The general kernel style is to avoid assignments within conditionals. - R. - To unsubscribe from this lis

Re: RFC: turn kmalloc+memset(,0,) into kcalloc

2005-04-05 Thread Jesper Juhl
On Tue, 5 Apr 2005, Paulo Marques wrote: > Hi, > I noticed there are a number of places in the kernel that do: > ptr = kmalloc(n * size, ...) > if (!ptr) > goto out; > memset(ptr, 0, n * size); > It seems that these could be replaced by: > ptr = kcalloc(n, siz

Re: RFC: turn kmalloc+memset(,0,) into kcalloc

2005-04-05 Thread Jörn Engel
On Tue, 5 April 2005 17:26:31 +0100, Paulo Marques wrote: > > Would this be a good thing to clean up, or isn't it worth the effort at all? I would welcome such a stream of patches. But in spite of the calloc interface being rather stupid, I'd prefer to see patches with kcalloc instead of kmalloc

RFC: turn kmalloc+memset(,0,) into kcalloc

2005-04-05 Thread Paulo Marques
Hi, I noticed there are a number of places in the kernel that do: ptr = kmalloc(n * size, ...) if (!ptr) goto out; memset(ptr, 0, n * size); It seems that these could be replaced by: ptr = kcalloc(n, size, ...) if (!ptr) goto o