From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753039Ab1I0NNX (ORCPT ); Tue, 27 Sep 2011 09:13:23 -0400 Received: from am1ehsobe005.messaging.microsoft.com ([213.199.154.208]:6192 "EHLO AM1EHSOBE005.bigfish.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751175Ab1I0NNV (ORCPT ); Tue, 27 Sep 2011 09:13:21 -0400 X-SpamScore: -18 X-BigFish: VPS-18(zz1432N98dKzz1202hzz15d4Rz32i668h839h944h61h) X-Spam-TCS-SCL: 0:0 X-Forefront-Antispam-Report: CIP:163.181.249.108;KIP:(null);UIP:(null);IPVD:NLI;H:ausb3twp01.amd.com;RD:none;EFVD:NLI X-WSS-ID: 0LS6NCL-01-5TY-02 X-M-MSG: Date: Tue, 27 Sep 2011 15:12:22 +0200 From: "Roedel, Joerg" To: Ohad Ben-Cohen CC: "iommu@lists.linux-foundation.org" , "linux-omap@vger.kernel.org" , Hiroshi DOYU , Laurent Pinchart , David Woodhouse , "linux-arm-kernel@lists.infradead.org" , David Brown , Arnd Bergmann , "linux-kernel@vger.kernel.org" , Stepan Moskovchenko , "kvm@vger.kernel.org" Subject: Re: [PATCH v3 1/6] iommu/core: split mapping to page sizes as supported by the hardware Message-ID: <20110927131222.GL2138@amd.com> References: <1316195506-9777-1-git-send-email-ohad@wizery.com> <1316195506-9777-2-git-send-email-ohad@wizery.com> <20110927100505.GH2138@amd.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) X-OriginatorOrg: amd.com Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Sep 27, 2011 at 08:26:29AM -0400, Ohad Ben-Cohen wrote: > > With an unsigned long you can use plain and fast bit_ops instead of the > > full bitmap functions. > > Not sure I follow; the only bit operation I'm using while mapping is > find_next_bit() (which is a bitops.h method). > > What other faster variant are you referring to ? You pass a pointer to an unsigned long for the page-size bitmap. This allows to use an array of unsigned long. But a single unsigned long is sufficient and you can use functions like ffs() and fls() together with shifting. These functions often translate to a single intruction in the binary. The find_next_bit function has much more overhead because it needs to handle the array-of-ulong case. Joerg -- AMD Operating System Research Center Advanced Micro Devices GmbH Einsteinring 24 85609 Dornach General Managers: Alberto Bozzo, Andrew Bowd Registration: Dornach, Landkr. Muenchen; Registerger. Muenchen, HRB Nr. 43632