Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754085AbdGCKag (ORCPT ); Mon, 3 Jul 2017 06:30:36 -0400 Received: from mail-pg0-f67.google.com ([74.125.83.67]:33940 "EHLO mail-pg0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753173AbdGCKae (ORCPT ); Mon, 3 Jul 2017 06:30:34 -0400 Subject: Re: [PATCH] zram: constify attribute_group structures. To: Sergey Senozhatsky References: <65680c1c4d85818f7094cbfa31c91bf28185ba1b.1499061182.git.arvind.yadav.cs@gmail.com> <20170703090047.GB517@jagdpanzerIV.localdomain> Cc: minchan@kernel.org, ngupta@vflare.org, linux-kernel@vger.kernel.org From: Arvind Yadav Message-ID: <11272aaf-edac-4463-c0a9-de509d8901d6@gmail.com> Date: Mon, 3 Jul 2017 16:00:24 +0530 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.5.1 MIME-Version: 1.0 In-Reply-To: <20170703090047.GB517@jagdpanzerIV.localdomain> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 990 Lines: 25 Hi, On Monday 03 July 2017 02:30 PM, Sergey Senozhatsky wrote: > On (07/03/17 11:43), Arvind Yadav wrote: >> attribute_groups are not supposed to change at runtime. All functions >> working with attribute_groups provided by work with const >> attribute_group. So mark the non-const structs as const. >> >> File size before: >> text data bss dec hex filename >> 8293 841 4 9138 23b2 drivers/block/zram/zram_drv.o >> >> File size After adding 'const': >> text data bss dec hex filename >> 8357 777 4 9138 23b2 drivers/block/zram/zram_drv.o > sorry, what exactly is the improvement here? > we grew .text bigger, why should we be happy about it? Yes, .text size is increased but .data size got decreased. Overall size will be same. the text segment is often read-only, to prevent a program from accidentally modifying its instructions. Here, attribute_group should be const. > -ss Thanks, ~arvind