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=-5.9 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=no 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 E2FC7C433ED for ; Wed, 5 May 2021 19:51:50 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 86286613B3 for ; Wed, 5 May 2021 19:51:50 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 86286613B3 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=canonical.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:Date:Message-ID:From: References:Cc:To:Subject:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=cxXlN1YwyAgYMSf2ydbLrf28bxKVmRjjfQzL/kZGAgQ=; b=RqWVDZRQZ4DWT394GbVMH98uT mAZiljmNljovh7mB9PreLl+aJdrtSpnvnbEU2MArxQaF6BLW8x1CN2Eri8+iT11vGYuHMbyinYv1x Ob/Fl/zy60QQ69syAfKEYdpQpxTp1FZV1Lm+MxXi4bjcKbYBOlvR/Ehekzv92wr+LjtkP400UruZN SGTTxeJCU8Y0eU8K7rB0PMNeBqxuC+UIEKkfZSNTBLuaNgxtlxOsvDBfvMVqgU4AwqDgIHosk2eOZ GT0k9XXzi5G8aG6Id3skXsLQ+a0zhagukuO6z+79s9d9GMutc3Kp79ZuXSoy/iRgSIML+9PmkPcfJ q4r89sWZg==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1leNWx-002C4G-90; Wed, 05 May 2021 19:49:59 +0000 Received: from bombadil.infradead.org ([2607:7c80:54:e::133]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1leNWt-002C42-OO for linux-arm-kernel@desiato.infradead.org; Wed, 05 May 2021 19:49:56 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: Content-Type:In-Reply-To:MIME-Version:Date:Message-ID:From:References:Cc:To: Subject:Sender:Reply-To:Content-ID:Content-Description; bh=YKyCl0DE54LbAuOM4KaQvnscMZIlI+LeNxxcn/7baXE=; b=ndieWNOHnjD1MfgEGRz/5cJ4Fl opjbrsVterp7OtAsoqF/vzXoB52X0eZrOLb4SSKkyVFP2Rk6Rvrh+wCOWMikhhX/H5eE32Z7+S61l xEJSK5m+U7GUvg7O0Ahn6MPPSetbyCrE5VS67yagfRyggLgvAXVhvG3G3i4Vy47+lrk++Zkpvl2WP 8VAlofGV5ydcgNg+2wx0CXJzdkJD6oHYo5DUfDnLrc34YpLekPSNPm2nwKDtdBuQGaJ0GJM4ckTio 9sEvWPfMDcWBCPsv0EJhX7lnqLs9eRBhOgWyDZj7EiCv4IgMRsftef8+xUseEpLOHlS5rhFLBHO7t 8Rb2KWgQ==; Received: from youngberry.canonical.com ([91.189.89.112]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1leNWr-005DFq-Ai for linux-arm-kernel@lists.infradead.org; Wed, 05 May 2021 19:49:54 +0000 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-Language: en-US X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210505_124953_400588_AB4EF701 X-CRM114-Status: GOOD ( 18.56 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.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 > _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel