Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp4093565img; Tue, 26 Mar 2019 02:54:19 -0700 (PDT) X-Google-Smtp-Source: APXvYqz1+bQaNKlx1OEzi7Iuff4SQXU7k+43riSlN7AVl5GPprA9nL0uEh01qwdyeNzdlJbbKi4d X-Received: by 2002:a63:5854:: with SMTP id i20mr18553651pgm.171.1553594059416; Tue, 26 Mar 2019 02:54:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553594059; cv=none; d=google.com; s=arc-20160816; b=PVQLZJSzXj5MfYL1TYmU4DAr9Mv6MIfqTpD2h7nTURTbh+IDZjs0vg7AWz+pcQRpqH AwvjgkYze85djfKgCGvbah0llb0520uW/d3h3uf0ytqX15pm3eVqaAXlXyurjKp9NI2K o7E0beidN3fQ7u3RaAfoy7rXZ3Mxe/LLRPGSUGkze4xWT3dtfKcslAflGMxxXzL79KEs DMCeB0rR4gw4J0Gst42ZnePbgjLoymcCx472ooPaMfX4TrOtAKLrnsaR0JwzmitJy5ET 9twQ876NPH2o/FuBRiIff/VuaBNZgwROdhVH4tTVaxtfGiCKNHvVe4/pDyA6H0ZAj5lc ArgA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:organization:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=HGZFCjFjp/VG8yP7Vbq9JaxEyyoH8+1/rvjn8axNrvE=; b=hqZAa1LEn7ySLKPK54shb2Hig9iqkn2cqC11M3fn9S3SSOWmYatsvjEJMsAxmfTedQ m3ywZI3cWzF1cbdZFZXsRLiJMbQWasmVdZ6MdpRkx0/LfQuqs2Pzb+Kq6YFIhdDABHQd HL3qtiNuTtmxWW3t0sOC7APxVeQmxcuGWvhmca11sVd+YTwMWS5G0bCJFlaKdAnGX8Oj eOCLT7wEIKl/yqYBJgl19VUCCdceZeK/BwBFafICacXzycldg5rPprXNsjAC55W6PAMB hU4zMo1u4+yBvZsbH8kPX6qplObmOL7X3a7STrM93rh90o0a85nxGq15NqAY57pBc0JT km/A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t8si16104507pgc.383.2019.03.26.02.54.04; Tue, 26 Mar 2019 02:54:19 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731324AbfCZJxT (ORCPT + 99 others); Tue, 26 Mar 2019 05:53:19 -0400 Received: from mga01.intel.com ([192.55.52.88]:6500 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730362AbfCZJxS (ORCPT ); Tue, 26 Mar 2019 05:53:18 -0400 X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 26 Mar 2019 02:53:17 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.60,271,1549958400"; d="scan'208";a="330747542" Received: from smile.fi.intel.com (HELO smile) ([10.237.72.86]) by fmsmga006.fm.intel.com with ESMTP; 26 Mar 2019 02:53:14 -0700 Received: from andy by smile with local (Exim 4.92) (envelope-from ) id 1h8ilc-0000xE-ED; Tue, 26 Mar 2019 11:53:12 +0200 Date: Tue, 26 Mar 2019 11:53:12 +0200 From: Andy Shevchenko To: Lukas Wunner Cc: William Breathitt Gray , linus.walleij@linaro.org, bgolaszewski@baylibre.com, akpm@linux-foundation.org, linux-gpio@vger.kernel.org, linux-arch@vger.kernel.org, linux-kernel@vger.kernel.org, linux@rasmusvillemoes.dk, yamada.masahiro@socionext.com, linux-arm-kernel@lists.infradead.org, linux-pm@vger.kernel.org, geert@linux-m68k.org, preid@electromag.com.au, Arnd Bergmann Subject: Re: [PATCH v12 01/11] bitops: Introduce the for_each_set_clump8 macro Message-ID: <20190326095312.GR9224@smile.fi.intel.com> References: <9afc30a574ce3e6a86b51dd522146a1d2156dedd.1553494625.git.vilhelm.gray@gmail.com> <20190325093854.jzkkwaksxi7zvtrg@wunner.de> <20190326031422.GB3356@icarus> <20190326094345.v7l7xjvfs2scbvbv@wunner.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190326094345.v7l7xjvfs2scbvbv@wunner.de> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Mar 26, 2019 at 10:43:45AM +0100, Lukas Wunner wrote: > On Tue, Mar 26, 2019 at 12:14:22PM +0900, William Breathitt Gray wrote: > > On Mon, Mar 25, 2019 at 10:38:54AM +0100, Lukas Wunner wrote: > > Is this the sort of implementation you had in mind: > > > > offset = find_next_bit(addr, size, offset); > > if (offset == size) > > return size; > > > > offset -= offset % 8; > > *clump = bitmap_get_value8(addr, size, offset); > > > > return offset; > > Almost. I'd use round_down() instead of "offset -= offset % 8". > Then it's just a single cheap logical and operation at runtime. > I'd try to avoid copying around the clump value and use a pointer > to u8 instead. u8 might be inconvenient in environment where everything else is type of unsigned long. -- With Best Regards, Andy Shevchenko