Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1759288AbXFDRPs (ORCPT ); Mon, 4 Jun 2007 13:15:48 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1757939AbXFDRPk (ORCPT ); Mon, 4 Jun 2007 13:15:40 -0400 Received: from outpipe-village-512-1.bc.nu ([81.2.110.250]:55672 "EHLO the-village.bc.nu" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1757719AbXFDRPk (ORCPT ); Mon, 4 Jun 2007 13:15:40 -0400 Date: Mon, 4 Jun 2007 18:20:25 +0100 From: Alan Cox To: Linus Torvalds Cc: Pekka Enberg , Christoph Lameter , Andrew Morton , linux-kernel@vger.kernel.org, jeremy@goop.org Subject: Re: SLUB: Return ZERO_SIZE_PTR for kmalloc(0) Message-ID: <20070604182025.558a8d10@the-village.bc.nu> In-Reply-To: References: <20070601204141.f84ad72f.akpm@linux-foundation.org> <20070601213117.1178e8e0.akpm@linux-foundation.org> <84144f020706040808t4882f961t80b8d8eb145bfa50@mail.gmail.com> <84144f020706040922v56cb10eg5a730b4abe9d5251@mail.gmail.com> X-Mailer: Claws Mail 2.9.1 (GTK+ 2.10.8; i386-redhat-linux-gnu) Organization: Red Hat UK Cyf., Amberley Place, 107-111 Peascod Street, Windsor, Berkshire, SL4 1TE, Y Deyrnas Gyfunol. Cofrestrwyd yng Nghymru a Lloegr o'r rhif cofrestru 3798903 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: 1176 Lines: 27 > The thing is, why *should* we care about comparing addresses? We'll give Because people use it to tell objects apart. All over the kernel we do things like if (inode1 == inode2) to figure out if they are the same inode. Now inodes are not zero sized so we are safe there > the right result (you got many perfectly separate allocations, they're > just zero bytes apart, exactly like you asked for!). The fact that C++ has > some semantics for it is not a good argument Its the usual semantic in languages that use a pointer as an object handle. C is actually the oddity here, the other languages use it to avoid aliasing of object handles and the resulting confusion. Clearly we do need an option to make the kernel explode when misusing such pointers for debugging whatever the default for other behaviour is. And on a 64bit box we probably have enough address space to hand out a few million unique faulting pointers. - 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/