Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S261251AbVEZHqT (ORCPT ); Thu, 26 May 2005 03:46:19 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S261255AbVEZHqT (ORCPT ); Thu, 26 May 2005 03:46:19 -0400 Received: from imf23aec.mail.bellsouth.net ([205.152.59.71]:128 "EHLO imf23aec.mail.bellsouth.net") by vger.kernel.org with ESMTP id S261251AbVEZHqI (ORCPT ); Thu, 26 May 2005 03:46:08 -0400 Message-ID: <009501c561ce$610b3990$2800000a@pc365dualp2> From: To: References: <1117044875.9510.2.camel@localhost> <20050526070437.GY29811@parcelfarce.linux.theplanet.co.uk> Subject: Re: ntfs: remove redundant assignments Date: Thu, 26 May 2005 04:39:00 -0400 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2800.1478 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1478 Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1707 Lines: 36 ---- Original Message ----- From: "Al Viro" To: "Pekka J Enberg" Cc: "Anton Altaparmakov" ; ; Sent: Thursday, May 26, 2005 03:04 Subject: Re: ntfs: remove redundant assignments > On Thu, May 26, 2005 at 09:21:46AM +0300, Pekka J Enberg wrote: > > On Wed, 2005-05-25 at 22:10 +0100, Anton Altaparmakov wrote: > > >This is not. memset(0) is not the same as = NULL IMO. I don't care if > > >the compiler thinks it is the same. NULL does not have to be 0 so I > > >prefer to initialize pointers explicitly to NULL. Even more so since this > > >code is not performance critical at all so I prefer clarity here. FWIW, a series of explicit assignments to zero puffs up the code on x86. Several GCC releases using the default kernel -O2 build are too dumb to zero EAX, or some other reg, and assign using it, so you're looking at 4 bytes of immediate zero plus opcode ModRm/SIB. If the locations being assigned happened to be statics you can often wind up with a 10 byte instruction to zero a single dword somewhere. I have tried a few tricks trying to get GCC to not use this 4 byte immediate 0 in non speed critical areas all to no avail (ex. foo &= 0; the AND instruction can use a one byte sign extended operand, but GCC morphs something like " &= 0" into a straight up "MOV thing,imm32" instruction) - 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/