Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp5487315ybp; Tue, 8 Oct 2019 03:43:54 -0700 (PDT) X-Google-Smtp-Source: APXvYqwDmAc/rVmoVoIcY2QhJLVOqYkV3UlgB8v+HklrhYuwviNHTrKozN+aqbJfCDIaIaRuNSLU X-Received: by 2002:a50:e718:: with SMTP id a24mr33333433edn.289.1570531434743; Tue, 08 Oct 2019 03:43:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570531434; cv=none; d=google.com; s=arc-20160816; b=jNoW5OJgQ6QSQIZjt8HvH+VqjITB6BihF7MuzlCa4HGpvNfiXx7+hVygsIDP1JkXnN gqZSO8tPN5foWSNMYipZXIC0JuzpjIcbRRI7sg+JQ/EGYq0KLPk/29638b/X/pwyCmQN CO4WSk72YVZqLSjJzA0HMKbgNwJWXmULaz21U75jlr+EyqUb2FGQzzo8uf60n8oz2Haa ovCxEc5336p9TKZT/etvBnXsbqaDIA6/W6VQC1o4jGwMKqE6A3huiEJ1LX5WoM0zdP4M DP++oh9GNRe2+Uhiy/OrUdl5wvse0usKO3bOyriL9G8D6Rn8PNQaXrqUo5X5z59wKoMo f5hg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=kNT0uravG5d+lNDf6zaLGqaWiN2XpE5JXyYmizVBilE=; b=MZEe7AOlVIeZHhsUWrG50y3la/aCNckrJVndJORATRAhS6OgPKfUZyDnImp9M9uUBT deUqvIgciNQXQQUlDr3Y0x0S+x5XYqql1HJWr+U5tcUTfqmkMtqHniaagoIEZKhn26M7 3F+l99Qz9zAMdnw74/cHYM9TAmt8uCn5LFYDvaj0TwF7yQAxRFFl36QI02lTtByW26m/ L+RNyRKfU6hvoVU/dTCucnUIJFTYu0ygLwRGgB40g5K2rwJono3Tc8R1ouvvqftnTydE t4otB/VXDiWleV/K+wZs5kgPR44Sal8W2LfcvAcYyekPs9Xi/3/n+/DPsHiUGSGMwgCO M9AA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=K9H4eDof; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id gh3si8116042ejb.306.2019.10.08.03.43.31; Tue, 08 Oct 2019 03:43:54 -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; dkim=pass header.i=@linaro.org header.s=google header.b=K9H4eDof; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730415AbfJHKnR (ORCPT + 99 others); Tue, 8 Oct 2019 06:43:17 -0400 Received: from mail-wm1-f65.google.com ([209.85.128.65]:51427 "EHLO mail-wm1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730016AbfJHKnQ (ORCPT ); Tue, 8 Oct 2019 06:43:16 -0400 Received: by mail-wm1-f65.google.com with SMTP id 7so2606186wme.1 for ; Tue, 08 Oct 2019 03:43:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=kNT0uravG5d+lNDf6zaLGqaWiN2XpE5JXyYmizVBilE=; b=K9H4eDofUQAKZFM6o8SaI1fDGTLc4h7zvLiQ1+kb/3hl9KTydNTP7sOmaT6ZOvOy+h qCDq8mzBa37VmuqcmWj5VvjaBvps+QwcM68guyWqS7cr9uaOY134H4lb7mkzoSRr4Buc MoeRrevZYD2M/FEAhj2Pmft/ekWeOstHP3Qd7drNLISZ3UzzZWZWJrRbTlsAaqGTlbMn zlC88mSLkqFcvForhTUElc0Tk8aobntBt2kXJ7UPWhnu9ZKaS1Q5JYKqELXmOkI4xbf4 4yCCbqemhFWRxC1rFNomOZHXO8jgNt7JK20q4ZEL/O60BOBasjqAhiJtzqMKkGJNHJHP hZBg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=kNT0uravG5d+lNDf6zaLGqaWiN2XpE5JXyYmizVBilE=; b=TToh/7R3qtniDC3+nRAIQVBuZMVDxft5vx1PLvHgyDe3MiERbt2bAlpOPVobTEDRLI zktK0pdMghWmkapBAoks+aI5Dyc4OcVX9lOuuLRkPdnw4qi9+Y0a8bgmphEz9fq8c+Vb SOVtni4JwllMea9UmcTGO/OqzrO5Ge2JdhuOgUWKtInGvM3LO8+6xTV5uWdor9Ujfu9r WAeFSQPhijiAWKfvsaOED6CZsMcRAy3lOfKD0R0J7KeKzia6Ou/aZAveTkeii7u3we97 Lh12JuQpkwHDM4Jy3OEADhfvAx/B9EemUD43/wWrcPYTHIIg8kMmCas6knF/6YcvT4ry P+9g== X-Gm-Message-State: APjAAAXB5pm+HGZGm2yp8eUWXk7UiOMFsfqFFUc1K261ErIuuR7F8Tr3 XiLlIkC096tB56kJFjDbbCtU9g== X-Received: by 2002:a7b:c7d4:: with SMTP id z20mr3278073wmk.145.1570531394197; Tue, 08 Oct 2019 03:43:14 -0700 (PDT) Received: from holly.lan (cpc141214-aztw34-2-0-cust773.18-1.cable.virginm.net. [86.9.19.6]) by smtp.gmail.com with ESMTPSA id b62sm4548867wmc.13.2019.10.08.03.43.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 08 Oct 2019 03:43:13 -0700 (PDT) Date: Tue, 8 Oct 2019 11:43:11 +0100 From: Daniel Thompson To: Rasmus Villemoes Cc: Thierry Reding , Lee Jones , Jingoo Han , Bartlomiej Zolnierkiewicz , linux-pwm@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-fbdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 3/5] backlight: pwm_bl: drop use of int_pow() Message-ID: <20191008104311.s4k5syr7gd7tb55w@holly.lan> References: <20190919140620.32407-1-linux@rasmusvillemoes.dk> <20190919140620.32407-3-linux@rasmusvillemoes.dk> <20191007152800.3nhbf7h7knumriz4@holly.lan> <5f19e307-29c4-f077-568d-b2bd6ae74608@rasmusvillemoes.dk> <20191008093145.kgx6ytkbycmmkist@holly.lan> <9bf6baf9-46be-771c-7e26-527b117c998a@rasmusvillemoes.dk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <9bf6baf9-46be-771c-7e26-527b117c998a@rasmusvillemoes.dk> User-Agent: NeoMutt/20180716 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Oct 08, 2019 at 12:02:07PM +0200, Rasmus Villemoes wrote: > On 08/10/2019 11.31, Daniel Thompson wrote: > > On Mon, Oct 07, 2019 at 08:43:31PM +0200, Rasmus Villemoes wrote: > >> On 07/10/2019 17.28, Daniel Thompson wrote: > >>> On Thu, Sep 19, 2019 at 04:06:18PM +0200, Rasmus Villemoes wrote: > >>> > >>> It feels like there is some rationale missing in the description here. > >>> > >> > >> Apart from the function call overhead (and resulting register pressure > >> etc.), using int_pow is less efficient (for an exponent of 3, it ends up > >> doing four 64x64 multiplications instead of just two). But feel free to > >> drop it, I'm not going to pursue it further - it just seemed like a > >> sensible thing to do while I was optimizing the code anyway. > >> > >> [At the time I wrote the patch, this was also the only user of int_pow > >> in the tree, so it also allowed removing int_pow altogether.] > > > > To be honest the change is fine but the patch description doesn't make > > sense if the only current purpose of the patch is as a optimization. > > Agreed. Do you want me to resend the series with patch 3 updated to read > > "For a fixed small exponent of 3, it is more efficient to simply use two > explicit multiplications rather than calling the int_pow() library > function: Aside from the function call overhead, its implementation > using repeated squaring means it ends up doing four 64x64 multiplications." > > (and obviously patch 5 dropped)? Yes, please. When you resend you can add my R-B: to all patches: Reviewed-by: Daniel Thompson Daniel. PS Don't mind either way but I wondered the following is clearer than the slightly funky multiply-and-assign expression (which isn't wrong but isn't very common either so my brain won't speed read it): retval = DIV_ROUND_CLOSEST_ULL(retval * retval * retval, scale * scale);