Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932490AbWCXRhy (ORCPT ); Fri, 24 Mar 2006 12:37:54 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1751293AbWCXRhx (ORCPT ); Fri, 24 Mar 2006 12:37:53 -0500 Received: from mail.gmx.net ([213.165.64.20]:37084 "HELO mail.gmx.net") by vger.kernel.org with SMTP id S1751281AbWCXRhx (ORCPT ); Fri, 24 Mar 2006 12:37:53 -0500 X-Authenticated: #271361 Date: Fri, 24 Mar 2006 18:37:42 +0100 From: Edgar Toernig To: Andreas Mohr Cc: lkml , john stultz , Dominik Brodowski Subject: Re: delay_tsc(): inefficient delay loop (2.6.16-mm1) Message-Id: <20060324183742.1b1986d1.froese@gmx.de> In-Reply-To: <20060324170436.GA1568@rhlx01.fht-esslingen.de> References: <20060324170436.GA1568@rhlx01.fht-esslingen.de> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Y-GMX-Trusted: 0 Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 659 Lines: 22 Andreas Mohr wrote: > > rdtscl(bclock); > + /* offset with bclock to have very simple comparison below */ > + loops += bclock; > do { > rep_nop(); > rdtscl(now); > - } while ((now-bclock) < loops); > + } while (now < loops); > } Hehe, optimizing delay loops *g* But your optimization is wrong. 'loops+bclock' and/or 'now' is likely to wrap around and then the test condition becomes bogus. Ciao, ET. - 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/