Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S261750AbVC0PBR (ORCPT ); Sun, 27 Mar 2005 10:01:17 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S261763AbVC0PBR (ORCPT ); Sun, 27 Mar 2005 10:01:17 -0500 Received: from omx2-ext.sgi.com ([192.48.171.19]:10128 "EHLO omx2.sgi.com") by vger.kernel.org with ESMTP id S261750AbVC0O7n (ORCPT ); Sun, 27 Mar 2005 09:59:43 -0500 Date: Sun, 27 Mar 2005 06:56:55 -0800 From: Paul Jackson To: Jesper Juhl Cc: rlrevell@joe-job.com, juhl-lkml@dif.dk, linux-os@analogic.com, arjan@infradead.org, ext2-devel@lists.sourceforge.net, linux-kernel@vger.kernel.org Subject: Re: [PATCH] no need to check for NULL before calling kfree() -fs/ext2/ Message-Id: <20050327065655.6474d5d6.pj@engr.sgi.com> In-Reply-To: References: <1111825958.6293.28.camel@laptopd505.fenrus.org> <1111881955.957.11.camel@mindpipe> Organization: SGI X-Mailer: Sylpheed version 1.0.0 (GTK+ 1.2.10; i686-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 X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1343 Lines: 28 > I added likely() and unlikely() to all tests, here are the results from 3 > runs on my box : Any chance you could summarize what these results are, for those of us too lazy to parse it all out? The time spent by one author to summarize in English what the numbers state can save the time of a hundred readers each individually having to parse the numbers. Just looking at the third run, it seems to me that "if (likely(p)) kfree(p);" beats a naked "kfree(p);" everytime, whether p is half NULL's, or very few NULL's, or almost all NULL's. If I'm reading this right, and if these results are valid, then we are going about this optimization all wrong, at least if your CPU is an AMD Athlon (T-bird). Weird. Instead of stripping the "if (p)" test, we should be changing it to "if (likely(p))", regardless of whether it is very likely, or unlikely, or in between. That is not what I would call intuitive. -- I won't rest till it's the best ... Programmer, Linux Scalability Paul Jackson 1.650.933.1373, 1.925.600.0401 - 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/