All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: Christoph Lameter <clameter@sgi.com>
Cc: dada1@cosmosbay.com, kosaki.motohiro@jp.fujitsu.com,
	nickpiggin@yahoo.com.au, hugh@veritas.com,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] vmallocinfo: Add NUMA informations
Date: Mon, 9 Jun 2008 14:05:03 -0700	[thread overview]
Message-ID: <20080609140503.83985d10.akpm@linux-foundation.org> (raw)
In-Reply-To: <Pine.LNX.4.64.0806090715020.29723@schroedinger.engr.sgi.com>

On Mon, 9 Jun 2008 07:16:48 -0700 (PDT)
Christoph Lameter <clameter@sgi.com> wrote:

> On Tue, 3 Jun 2008, Andrew Morton wrote:
> 
> > > +	if (NUMA_BUILD) {
> > > +		unsigned int *counters, nr;
> > > +
> > > +		counters = kzalloc(nr_node_ids * sizeof(unsigned int),
> > 
> > This is kcalloc().  If you like that sorts of thing - I think kcalloc()
> > is pretty pointless personally.
> 
> Same here. I think its generally ignored. I tried to remove it at some 
> point in the past. If we want kcalloc then we also need kczalloc.

kcalloc() zeroes the returned memory - it's like calloc().

> It would 
> be best to keep the interface simple.

yup.  Oh well, it's not a big deal.

Except the inlined

        if (n != 0 && size > ULONG_MAX / n)
                return NULL;

is a bit bloaty/inefficient.  I expect that it's often the case that
one of `n' and `size' is not a compile-time constant.

otoh, there's one good thing about kcalloc: it actually checks for
multiplicative overflows, whereas the open-coded version often forgets
to do that.


  reply	other threads:[~2008-06-09 21:05 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-06-02  6:54 [PATCH] vmallocinfo: Add NUMA informations Eric Dumazet
2008-06-02  7:09 ` KOSAKI Motohiro
2008-06-03  3:37   ` Eric Dumazet
2008-06-03  4:35     ` KOSAKI Motohiro
2008-06-09 14:14       ` Christoph Lameter
2008-06-03 21:40     ` Andrew Morton
2008-06-04 15:01       ` Eric Dumazet
2008-06-04 15:33         ` Randy Dunlap
2008-06-09 14:19         ` Christoph Lameter
2008-06-09 14:16       ` Christoph Lameter
2008-06-09 21:05         ` Andrew Morton [this message]
2008-06-09 21:12           ` Pekka Enberg

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=20080609140503.83985d10.akpm@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=clameter@sgi.com \
    --cc=dada1@cosmosbay.com \
    --cc=hugh@veritas.com \
    --cc=kosaki.motohiro@jp.fujitsu.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nickpiggin@yahoo.com.au \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.