Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758315AbYFIVFf (ORCPT ); Mon, 9 Jun 2008 17:05:35 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1753779AbYFIVFZ (ORCPT ); Mon, 9 Jun 2008 17:05:25 -0400 Received: from smtp1.linux-foundation.org ([140.211.169.13]:47917 "EHLO smtp1.linux-foundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752875AbYFIVFZ (ORCPT ); Mon, 9 Jun 2008 17:05:25 -0400 Date: Mon, 9 Jun 2008 14:05:03 -0700 From: Andrew Morton To: Christoph Lameter 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 Message-Id: <20080609140503.83985d10.akpm@linux-foundation.org> In-Reply-To: References: <48439916.2070108@cosmosbay.com> <20080602160548.B6D4.KOSAKI.MOTOHIRO@jp.fujitsu.com> <4844BC75.8040705@cosmosbay.com> <20080603144054.973284bb.akpm@linux-foundation.org> X-Mailer: Sylpheed version 2.2.4 (GTK+ 2.8.20; i486-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1293 Lines: 40 On Mon, 9 Jun 2008 07:16:48 -0700 (PDT) Christoph Lameter 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@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/