From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932490AbVHIKJc (ORCPT ); Tue, 9 Aug 2005 06:09:32 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S932501AbVHIKJc (ORCPT ); Tue, 9 Aug 2005 06:09:32 -0400 Received: from mx2.suse.de ([195.135.220.15]:46987 "EHLO mx2.suse.de") by vger.kernel.org with ESMTP id S932490AbVHIKJc (ORCPT ); Tue, 9 Aug 2005 06:09:32 -0400 Date: Tue, 09 Aug 2005 12:09:29 +0200 Message-ID: From: Takashi Iwai To: Adrian Bunk Cc: Pekka J Enberg , Andrew Morton , linux-kernel@vger.kernel.org, pmarques@grupopie.com Subject: Re: [PATCH] kernel: use kcalloc instead kmalloc/memset In-Reply-To: <20050808210524.GK4006@stusta.de> References: <1123219747.20398.1.camel@localhost> <20050804223842.2b3abeee.akpm@osdl.org> <20050804233634.1406e92a.akpm@osdl.org> <20050806150940.GT4029@stusta.de> <20050808210524.GK4006@stusta.de> User-Agent: Wanderlust/2.12.0 (Your Wildest Dreams) SEMI/1.14.6 (Maruoka) FLIM/1.14.7 (=?ISO-8859-4?Q?Sanj=F2?=) APEL/10.6 MULE XEmacs/21.5 (beta18) (chestnut) (+CVS-20041021) (i386-suse-linux) MIME-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org At Mon, 8 Aug 2005 23:05:24 +0200, Adrian Bunk wrote: > > On Mon, Aug 08, 2005 at 12:11:21PM +0200, Takashi Iwai wrote: > > At Sat, 6 Aug 2005 17:09:40 +0200, > > Adrian Bunk wrote: > > > > > > > > > Looking at how few is left from kcalloc, can't we make it a > > > "static inline" function in slab.h? > > > > > > This would optimize nicely for all of the users where the first or even > > > the first two parameters are constant at compile-time and shouldn't do > > > much harm for the other users. > > > > > > As a side effect, the difference between kcalloc(1, ...) and kzalloc() > > > would become a coding style question without any effect on the generated > > > code. > > > > How about to use __builtin_constant_p() like kmalloc? > > The code readability would be worsen, though... > > Where should this make any difference? > > If the function is "static inline", gcc can e.g. always determine at > compile-time that 1 >= 0 can never be false and therefore optimize it > away. Argh, forget my post. It was just lack of caffeine :) Takashi