Messages in this thread | | | Date | Mon, 9 Jun 2008 14:05:03 -0700 | From | Andrew Morton <> | Subject | Re: [PATCH] vmallocinfo: Add NUMA informations |
| |
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.
| |