Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S262021AbVCZHuP (ORCPT ); Sat, 26 Mar 2005 02:50:15 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S262022AbVCZHuP (ORCPT ); Sat, 26 Mar 2005 02:50:15 -0500 Received: from wproxy.gmail.com ([64.233.184.207]:61805 "EHLO wproxy.gmail.com") by vger.kernel.org with ESMTP id S262021AbVCZHuL (ORCPT ); Sat, 26 Mar 2005 02:50:11 -0500 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:reply-to:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:references; b=qxYoKThpn21Bx2qs1D+ArTjT5RqFJSrfbOSDk9og2EVeFhcLEenafNNMrrL1j5GmfH95LdBXXGQU9YLifC7/CEyJrwjMwvk2+e98Kayb6D84TRytBi2oPzQ5vL8zTaJIY281nWdPqF9Efk2yeLKL8KuidL36ibQPKkY5Y/H3/ns= Message-ID: <84144f020503252350550cd23b@mail.gmail.com> Date: Sat, 26 Mar 2005 09:50:11 +0200 From: Pekka Enberg Reply-To: Pekka Enberg To: linux-os@analogic.com Subject: Re: [PATCH] no need to check for NULL before calling kfree() - fs/ext2/ Cc: Jesper Juhl , ext2-devel@lists.sourceforge.net, linux-kernel@vger.kernel.org, penberg@cs.helsinki.fi In-Reply-To: Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit References: Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 880 Lines: 21 Hi, On Fri, 25 Mar 2005 17:29:56 -0500 (EST), linux-os wrote: > Isn't it expensive of CPU time to call kfree() even though the > pointer may have already been freed? I suggest that the check > for a NULL before the call is much less expensive than calling > kfree() and doing the check there. The resulting "double check" > is cheap, compared to the call. Resource release paths are usually not performance critical. However, if removing the redundant checks introduce a _measurable_ regressions in terms of performance, we can make kfree() inline which will take care of 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/