[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20080609140503.83985d10.akpm@linux-foundation.org>
Date: Mon, 9 Jun 2008 14:05:03 -0700
From: Andrew Morton <akpm@...ux-foundation.org>
To: Christoph Lameter <clameter@....com>
Cc: dada1@...mosbay.com, kosaki.motohiro@...fujitsu.com,
nickpiggin@...oo.com.au, hugh@...itas.com,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] vmallocinfo: Add NUMA informations
On Mon, 9 Jun 2008 07:16:48 -0700 (PDT)
Christoph Lameter <clameter@....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.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists