Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965085AbWCTQPP (ORCPT ); Mon, 20 Mar 2006 11:15:15 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S965087AbWCTQPO (ORCPT ); Mon, 20 Mar 2006 11:15:14 -0500 Received: from zproxy.gmail.com ([64.233.162.204]:21229 "EHLO zproxy.gmail.com") by vger.kernel.org with ESMTP id S965085AbWCTQPK convert rfc822-to-8bit (ORCPT ); Mon, 20 Mar 2006 11:15:10 -0500 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:sender:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=fR9XF4PlKXj5Z+h2fjmKj7tqxZFwaMPdQHrbGCNzYR+yUnaOOEKOiGxHeCRLfi5IzcJkkoCZIQ9GL5O6B3g3vzGwtaXgfMmP4vN8gJ6Xhvcw+UjMvIlcslCZeKINOcq1cuTeXw/dprsvEjCk67WA/lLvqrrh7ji8rRyexkyiWPE= Message-ID: <84144f020603200815o66cb689cv239cbe190f9e6f30@mail.gmail.com> Date: Mon, 20 Mar 2006 18:15:08 +0200 From: "Pekka Enberg" To: "Benjamin LaHaise" Subject: Re: [PATCH]micro optimization of kcalloc Cc: "Oliver Neukum" , linux-kernel@vger.kernel.org, "Adrian Bunk" In-Reply-To: <20060320151433.GE16108@kvack.org> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7BIT Content-Disposition: inline References: <20060320151433.GE16108@kvack.org> Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 910 Lines: 25 Hi, On Mon, Mar 20, 2006 at 03:45:23PM +0100, Oliver Neukum wrote: > > static inline void *kcalloc(size_t n, size_t size, gfp_t flags) > > { > > - if (n != 0 && size > INT_MAX / n) > > + if (unlikely(size != 0 && n > INT_MAX / size )) > > return NULL; > > return kzalloc(n * size, flags); > > } On 3/20/06, Benjamin LaHaise wrote: > This function shouldn't be inlined. We have no need to optimize the > unlikely case like this. IIRC, I made it static inline in the first place because that actually reduced kernel text size. (And I think it was Adrian who made me do it :-). Pekka - 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/