From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755777AbWKQSOV (ORCPT ); Fri, 17 Nov 2006 13:14:21 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1755771AbWKQSOV (ORCPT ); Fri, 17 Nov 2006 13:14:21 -0500 Received: from homer.mvista.com ([63.81.120.158]:21753 "EHLO gateway-1237.mvista.com") by vger.kernel.org with ESMTP id S1755774AbWKQSOU (ORCPT ); Fri, 17 Nov 2006 13:14:20 -0500 Subject: Re: [PATCH] Allow NULL pointers in percpu_free From: Daniel Walker To: Alan Stern Cc: Andrew Morton , Venkatesh Pallipadi , Jens Axboe , Christoph Lameter , Pedro Roque , "David S. Miller" , "Paul E. McKenney" , Kernel development list In-Reply-To: References: Content-Type: text/plain Date: Fri, 17 Nov 2006 10:14:07 -0800 Message-Id: <1163787247.3097.14.camel@localhost.localdomain> Mime-Version: 1.0 X-Mailer: Evolution 2.6.3 (2.6.3-1.fc5.5) Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 2006-11-17 at 13:07 -0500, Alan Stern wrote: > On Fri, 17 Nov 2006, Daniel Walker wrote: > > > On Fri, 2006-11-17 at 12:36 -0500, Alan Stern wrote: > > > > > void percpu_free(void *__pdata) > > > { > > > + if (!__pdata) > > > + return; > > > > Should be unlikely() right? > > It certainly could be. I tend not to put such annotations in my code, but > it wouldn't hurt. It's actually a really good idea to add them .. I've noticed they tend to make my kernels smaller, although I wouldn't expect that to always be the case.. Another reason is that in -mm we can track how often this condition is triggered with likely profiling. With kfree, for instance, there were a number of callers that frequently called kfree(NULL), which IMO isn't good. Daniel