Received: by 2002:a05:6a10:a852:0:0:0:0 with SMTP id d18csp789577pxy; Wed, 5 May 2021 14:04:22 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyOwPY/DFj0N/+3eA8v1/+/r72kzhVBDxuSxV0vyPfFxdbavyrwAnGL5sJDwzACnj5JwEfV X-Received: by 2002:a05:6402:4403:: with SMTP id y3mr1000882eda.369.1620248662789; Wed, 05 May 2021 14:04:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620248662; cv=none; d=google.com; s=arc-20160816; b=tdPxIYtmCYXJ2eh9zrP56nLfU4Waz9sxB+egrISQ6Emxr7ajpyU3SsZYlOgrT1ndUp xvpMw6kk417HweXZVNfYkSVf/MnZQEyNDw3JOn7cTiZzN9OA9GQT1rl57Q8IM5E4c6H5 hXofj0a4HFNkv8YWtvRvA5xB9NtED9QP225nzOyq+Q55dmK4JAEAdsX0vpPzR5MaheuT FvRK4pg779C9Mod5+m4Tij45HdmEC4jpg0gY7KjyXaGwk0mEnzIIVT3hk+GUGck78PC5 FDpImPzaVQXg2kv0zoUN0aDacMfys4pWhYZfjJrYmrjV0Qhn5n4JpRr++/tMnPiU2aEy i0mg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject; bh=YKyCl0DE54LbAuOM4KaQvnscMZIlI+LeNxxcn/7baXE=; b=GI+rj7lzWry78f/WWYj3cCAF2HlfUHRKusqLzvsJ+/SbGBZTecA2DgPeddlAC2btZ3 g6l64UFz9bHLS8/Vw7K1YgCKCdeQPuavprQQr9ZC54JD5T9EJbdGy34YEQkpu9v5fvFR PulqrgySgfKTB5tXEgfMpLjTV9XyLpI4CSzqI7kk0hAxW1hluCmzrVi6OukpD67KeaMX Q9RXIiQoQQRs1yN2sfykFQ0uh1K3on7AJAAqFBw856Dcd1mSPn4sK2SVUfQLpIY61Qhz Y3sebHAoQPI+sWvuBUUaSvw6peezDKn2R+fk6PMHuK3lDMNkW68ajxytRxxZfOCyk86q urkg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=canonical.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id nc10si326183ejc.266.2021.05.05.14.03.58; Wed, 05 May 2021 14:04:22 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=canonical.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233509AbhEETuu (ORCPT + 99 others); Wed, 5 May 2021 15:50:50 -0400 Received: from youngberry.canonical.com ([91.189.89.112]:36887 "EHLO youngberry.canonical.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233114AbhEETut (ORCPT ); Wed, 5 May 2021 15:50:49 -0400 Received: from cpc154979-craw9-2-0-cust193.16-3.cable.virginm.net ([80.193.200.194] helo=[192.168.0.210]) by youngberry.canonical.com with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.93) (envelope-from ) id 1leNWp-0003ku-NP; Wed, 05 May 2021 19:49:51 +0000 Subject: Re: [PATCH] scsi: ufs: ufs-exynos: make a const array static, makes object smaller To: Krzysztof Kozlowski , Alim Akhtar , Avri Altman , "James E . J . Bottomley" , "Martin K . Petersen" , linux-scsi@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org Cc: kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org References: <20210505190104.70112-1-colin.king@canonical.com> <0e90b057-3a87-bec5-c0b2-46c49b191651@canonical.com> From: Colin Ian King Message-ID: Date: Wed, 5 May 2021 20:49:51 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.8.1 MIME-Version: 1.0 In-Reply-To: <0e90b057-3a87-bec5-c0b2-46c49b191651@canonical.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 05/05/2021 20:41, Krzysztof Kozlowski wrote: > On 05/05/2021 15:01, Colin King wrote: >> From: Colin Ian King >> >> Don't populate the const array granularity_tbl on the stack but instead it >> static. Makes the object code smaller by 190 bytes: >> >> Before: >> text data bss dec hex filename >> 25563 6908 0 32471 7ed7 ./drivers/scsi/ufs/ufs-exynos.o >> >> After: >> text data bss dec hex filename >> 25213 7068 0 32281 7e19 ./drivers/scsi/ufs/ufs-exynos.o >> >> (gcc version 10.3.0) > > I am not sure what's the benefit here - you moved the code from text to > data. In total you decreased the size for this compilation settings > (e.g. compiler + optimizations) but that might not be always true, right? It is a marginal saving, but for arrays this size it makes sense to not have to populate the data into the stack before using it and then discarding it. This change essentially replaces quite a lot of instructions that put the data onto the stack so I think it's worth while. > > This has effect on the code readability - line is longer and reader > would think "why this was made static since it is simple one-time const?". > Not sure how to respond to this. If they wonder why it is static const and don't know why then one would hope they look it up in K&R and familiarize themselves with C. It's not so subtle. Colin > > Best regards, > Krzysztof >