From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.5 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_PASS,USER_AGENT_MUTT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A87E3C43381 for ; Tue, 26 Mar 2019 09:53:20 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 6CECB20830 for ; Tue, 26 Mar 2019 09:53:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731339AbfCZJxT (ORCPT ); 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