Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp4179163img; Tue, 26 Mar 2019 04:43:57 -0700 (PDT) X-Google-Smtp-Source: APXvYqwRjIAA68qyKDUoh4mjmXVZeA8acUJf6dhVVm2vgWQ5fFYLid7/N4iXhaY10hd2Md8ynF2L X-Received: by 2002:a17:902:1003:: with SMTP id b3mr31079124pla.306.1553600637088; Tue, 26 Mar 2019 04:43:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553600637; cv=none; d=google.com; s=arc-20160816; b=RAc1cR71o8DvDo8hXibHvHvISkljgDW1f+RetlDvC1TZrEEydYegVNKvwBGYFS9clc 2cMnEkL0d5SRTZvZwTfDoXJf/kNf4AnA9BMTrYLCn1gPYNW8CL73eZ14iezsq0LSXOdG yfuvmQK92YhXRtZRBX2S0hNhm1TMUg1M79+wM/XnXKwrc/HUZDr55WhRKEYNQkYSXFYP fNmB49qYNKtX4jz9ekIU8xayHxPU1YVG5gUbYJrnHWIl3HaBoD8zCh8ooR4tQX2tISpc 4wbmKL3PVCwf3O9dQQGdhno8TWH+vnQ0agz+XfFO68bl6CLrHkAgJvmbEHFMDFgiN3ng 61mg== 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=BfoDXGqjKTsQn/C6plItBZRxYA0I6LFozrnuaK0i1ho=; b=xxXTvqjdxkqxYg6N75tGFkhBAeIJgCeiVT+a6LKBiO6rnxgWzY2qX96LWDwAHPphrK UUU7XwMnYou58+kiFy8uUKpm6yJjXwunZ/9rCxEAApTFYStCYrXKvxtdw82stSH/TKbC wVoZnHn67cNaZPMe/jMvBYLjCRHnx1+jc2iOIaH1j5Sq1FaPegRTucQhy5SIg+C+LfUT oeYF3RZY+Hnp5kUE6BNzZz8cBI5vs6yy2rjsITZWzKVNL+Cbk6bL231C4wof1QN4BI1Z ThD/tArBUopaJZfJiJ0m9bU6UQX2If4c7Y3nKNcdCYVrTN2F8zfNIF2oHdM+SPWPsdQ6 M0KA== 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 e23si15248161pgv.215.2019.03.26.04.43.41; Tue, 26 Mar 2019 04:43:57 -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 S1731360AbfCZLm6 (ORCPT + 99 others); Tue, 26 Mar 2019 07:42:58 -0400 Received: from mga12.intel.com ([192.55.52.136]:41688 "EHLO mga12.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726140AbfCZLm6 (ORCPT ); Tue, 26 Mar 2019 07:42:58 -0400 X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga106.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 26 Mar 2019 04:42:57 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.60,271,1549958400"; d="scan'208";a="155297237" Received: from smile.fi.intel.com (HELO smile) ([10.237.72.86]) by fmsmga002.fm.intel.com with ESMTP; 26 Mar 2019 04:42:53 -0700 Received: from andy by smile with local (Exim 4.92) (envelope-from ) id 1h8kTk-0002Cj-79; Tue, 26 Mar 2019 13:42:52 +0200 Date: Tue, 26 Mar 2019 13:42:52 +0200 From: Andy Shevchenko To: William Breathitt Gray Cc: 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: <20190326114252.GX9224@smile.fi.intel.com> References: <9afc30a574ce3e6a86b51dd522146a1d2156dedd.1553494625.git.vilhelm.gray@gmail.com> <20190325131236.GW9224@smile.fi.intel.com> <20190326025459.GA3356@icarus> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190326025459.GA3356@icarus> 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 11:54:59AM +0900, William Breathitt Gray wrote: > On Mon, Mar 25, 2019 at 03:12:36PM +0200, Andy Shevchenko wrote: > > On Mon, Mar 25, 2019 at 03:22:23PM +0900, William Breathitt Gray wrote: > > > This macro iterates for each 8-bit group of bits (clump) with set bits, > > > within a bitmap memory region. For each iteration, "start" is set to the > > > bit offset of the found clump, while the respective clump value is > > > stored to the location pointed by "clump". Additionally, the > > > bitmap_get_value8 and bitmap_set_value8 functions are introduced to > > > respectively get and set an 8-bit value in a bitmap memory region. > > > > > > This seems to miss Randy's (IIRC) comment about too many const specifiers. > > I disagree with removing the const qualifiers; I believe they are useful > and do not significantly impact the clarity of the code (in fact, I'd > argue the opposite). Had you checked the assembly? I'm talking about const for values on the stack. I think if you put less const there compiler can keep something in the registers instead of using direct constants or accessing stack. I might be mistaken, so, I can't argue without evidence of either. > The const qualifiers make it clear these values are > constant, allowing readers at a glace to know these values never change > within this function. Although I believe GCC is smart enough in this > case to deduce implicitly that these are constant values, generally > speaking const qualifiers do make it easier for compilers to optimize > sections of code (OoO execution, algorithm simplification, etc.), so I > believe it's useful in a technical sense as well. Again, what the difference do you see in assembly if any? > I added the const qualifier to these variables because they really are > constant, and I believe there is merit in making it explicit in the > code. If the primary reason for removing the const qualifiers is for > aesthetics, then I must dissent with that decision. The point is, if there is no difference, I would prefer one which will be better to read, otherwise check the assembly. > However, it is difficult to read the definitions that wrap around to a > second line. These definitions are long enough that even removing the > const qualifiers would not help prevent the wrapping, so perhaps it > would make to let these stay on a single line. Do you think it would > help to ignore the 80-character maximum line width coding style rule for > these cases here? 80-characters rule can be slightly bended depending on the context. Here, I think, we might continue discussing the matter after having an evidence how const qualifiers affect the code. -- With Best Regards, Andy Shevchenko