netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Joe Perches <joe@perches.com>
To: Anirban Chakraborty <anirban.chakraborty@qlogic.com>
Cc: Dan Carpenter <error27@gmail.com>,
	Amit Salecha <amit.salecha@qlogic.com>,
	Linux Driver <Linux-Driver@qlogic.com>,
	"David S. Miller" <davem@davemloft.net>,
	Sucheta Chakraborty <sucheta.chakraborty@qlogic.com>,
	"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
	"kernel-janitors@vger.kernel.org"
	<kernel-janitors@vger.kernel.org>
Subject: Re: [patch 2/2] qlcnic: using too much stack
Date: Mon, 09 Aug 2010 19:03:21 -0700	[thread overview]
Message-ID: <1281405801.1954.65.camel@Joe-Laptop.home> (raw)
In-Reply-To: <9F31A875-3A0B-4518-8106-1012E0D2799B@qlogic.com>

On Mon, 2010-08-09 at 18:43 -0700, Anirban Chakraborty wrote:
> Your patch is fine except that the preferred way is to use kzalloc over kaclloc. kzalloc does not need that extra
> argument that you are passing to kcalloc.

You probably meant to write "my preferred way"
as the kcalloc to "kzalloc with a multiply"
ratio is pretty high.

It's actually about 2.5 to 1 in favor of kcalloc.

$ grep -rw --include=*.[ch] kcalloc * | wc -l
419

$ grep -rP --include=*.[ch] "\bkzalloc\s*\(\s*\w+\s*\*\s*\w+" * | \
  grep -vP "\bkzalloc\s*\(\s*sizeof\s+\*\s*\w+\s*," | wc -l
164

(the grep -vP avoids kzalloc(sizeof *p, GFP_foo)

Actually, there might be a reason to use kzalloc
in that location to match the other similar use
a few lines away, but I'd prefer that the other
use be converted to kcalloc.

cheers, Joe


  reply	other threads:[~2010-08-10  2:03 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-08-09 10:37 [patch 2/2] qlcnic: using too much stack Dan Carpenter
2010-08-09 16:46 ` Anirban Chakraborty
2010-08-09 18:42   ` Dan Carpenter
2010-08-10  1:43     ` Anirban Chakraborty
2010-08-10  2:03       ` Joe Perches [this message]
2010-08-10  3:31         ` Anirban Chakraborty
2010-08-10  3:39           ` Joe Perches
2010-08-10  7:01             ` David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1281405801.1954.65.camel@Joe-Laptop.home \
    --to=joe@perches.com \
    --cc=Linux-Driver@qlogic.com \
    --cc=amit.salecha@qlogic.com \
    --cc=anirban.chakraborty@qlogic.com \
    --cc=davem@davemloft.net \
    --cc=error27@gmail.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=sucheta.chakraborty@qlogic.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).