From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail203.messagelabs.com (mail203.messagelabs.com [216.82.254.243]) by kanga.kvack.org (Postfix) with ESMTP id 967CE6B003D for ; Thu, 19 Feb 2009 13:10:10 -0500 (EST) Subject: Re: [patch 1/7] slab: introduce kzfree() From: Matt Mackall In-Reply-To: References: <499BE7F8.80901@csr.com> <1234954488.24030.46.camel@penberg-laptop> <20090219101336.9556.A69D9226@jp.fujitsu.com> <1235034817.29813.6.camel@penberg-laptop> Content-Type: text/plain Date: Thu, 19 Feb 2009 12:02:36 -0600 Message-Id: <1235066556.3166.26.camel@calx> Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: owner-linux-mm@kvack.org To: Hugh Dickins Cc: Pekka Enberg , KOSAKI Motohiro , David Vrabel , Johannes Weiner , Andrew Morton , Chas Williams , Evgeniy Polyakov , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Christoph Lameter , Nick Piggin List-ID: On Thu, 2009-02-19 at 16:34 +0000, Hugh Dickins wrote: > On Thu, 19 Feb 2009, Pekka Enberg wrote: > > On Wed, 2009-02-18 at 10:50 +0000, David Vrabel wrote: > > > > > Johannes Weiner wrote: > > > > > > +void kzfree(const void *p) > > > > > > > > > > Shouldn't this be void * since it writes to the memory? > > > > > > > > No. kfree() writes to the memory as well to update freelists, poisoning > > > > and such so kzfree() is not at all different from it. > > > > On Thu, 2009-02-19 at 10:22 +0900, KOSAKI Motohiro wrote: > > > I don't think so. It's debetable thing. > > > > > > poisonig is transparent feature from caller. > > > but the caller of kzfree() know to fill memory and it should know. > > > > Debatable, sure, but doesn't seem like a big enough reason to make > > kzfree() differ from kfree(). > > There may be more important things for us to worry about, > but I do strongly agree with KOSAKI-san on this. > > kzfree() already differs from kfree() by a "z": that "z" says please > zero the buffer pointed to; "const" says it won't modify the buffer > pointed to. What sense does kzfree(const void *) make? Why is > keeping the declarations the same apart from the "z" desirable? > > By all means refuse to add kzfree(), but please don't add it with const. > > I can see that the "const" in kfree(const void *) is debatable > [looks to see how userspace free() is defined: without a const], > I can see that it might be nice to have some "goesaway" attribute > for such pointers instead; but I don't see how you can argue for > kzalloc(const void *). This is what Linus said last time this came up: http://lkml.org/lkml/2008/1/16/227 -- http://selenic.com : development and support for Mercurial and Linux -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: email@kvack.org