From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jan-Bernd Themann Subject: Re: [PATCH 1/6] ehea: interface to network stack Date: Mon, 14 Aug 2006 17:43:21 +0200 Message-ID: <44E09A19.9050205@de.ibm.com> References: <44D99EFC.3000105@de.ibm.com> <20060811205624.GE479@krispykreme> <20060814112656.GC10164@wohnheim.fh-wedel.de> <20060814143842.GM479@krispykreme> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: =?ISO-8859-1?Q?J=F6rn_Engel?= , netdev , linux-ppc , linux-kernel , Marcus Eder , Christoph Raisch , Thomas Klein Return-path: Received: from mtagate1.uk.ibm.com ([195.212.29.134]:45416 "EHLO mtagate1.uk.ibm.com") by vger.kernel.org with ESMTP id S1751490AbWHNQWR (ORCPT ); Mon, 14 Aug 2006 12:22:17 -0400 To: Anton Blanchard In-Reply-To: <20060814143842.GM479@krispykreme> Sender: netdev-owner@vger.kernel.org List-Id: netdev.vger.kernel.org Hi, Anton Blanchard wrote: >> Is a conditional cheaper than a divide? In case of a misprediction I >> would assume it to be significantly slower and I don't know the ratio >> of mispredictions for this branch. > > A quick scan of the web shows 40 cycles for athlon64 idiv, and its > similarly slow on many other cpus. Even assuming you mispredict every > branch its going to be a win. > > Anton as our queue size is always a power of 2, we simply use: i++; i &= (ringbufferlength - 1) So we can get along without the if. Jan-Bernd