Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S261722AbVC3Cre (ORCPT ); Tue, 29 Mar 2005 21:47:34 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S261394AbVC3Crd (ORCPT ); Tue, 29 Mar 2005 21:47:33 -0500 Received: from omx2-ext.sgi.com ([192.48.171.19]:42172 "EHLO omx2.sgi.com") by vger.kernel.org with ESMTP id S261721AbVC3Cr1 (ORCPT ); Tue, 29 Mar 2005 21:47:27 -0500 Date: Tue, 29 Mar 2005 18:44:11 -0800 From: Paul Jackson To: "Pekka J Enberg" Cc: jengelh@linux01.gwdg.de, penberg@gmail.com, rlrevell@joe-job.com, davej@redhat.com, linux-kernel@vger.kernel.org Subject: Re: no need to check for NULL before calling kfree() -fs/ext2/ Message-Id: <20050329184411.1faa71eb.pj@engr.sgi.com> In-Reply-To: References: <1111825958.6293.28.camel@laptopd505.fenrus.org> <1111881955.957.11.camel@mindpipe> <20050327065655.6474d5d6.pj@engr.sgi.com> <20050327174026.GA708@redhat.com> <1112064777.19014.17.camel@mindpipe> <84144f02050328223017b17746@mail.gmail.com> 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: 1335 Lines: 35 Pekka wrote: > (4) The cleanups Jesper and others are doing are to remove the > _redundant_ NULL checks (i.e. it is now checked twice). Even such obvious changes as removing redundant checks doesn't seem to ensure a performance improvement. Jesper Juhl posted performance data for such changes in his microbenchmark a couple of days ago. As I posted then, I could swear that his numbers show: > 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. Twice now I have asked Jesper to explain this strange result. I have heard no explanation (not even a terse "you idiot ;)"), nor anyone else comment on these numbers. Maybe we should be following your good advice: > You don't know that until you profile! instead of continuing to make these code changes. -- 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/