From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932792AbcHVQ5a (ORCPT ); Mon, 22 Aug 2016 12:57:30 -0400 Received: from smtprelay0190.hostedemail.com ([216.40.44.190]:40679 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S932297AbcHVQ51 (ORCPT ); Mon, 22 Aug 2016 12:57:27 -0400 X-Session-Marker: 6A6F6540706572636865732E636F6D X-Spam-Summary: 2,0,0,,d41d8cd98f00b204,joe@perches.com,:::::::::::,RULES_HIT:41:355:379:541:599:973:988:989:1260:1277:1311:1313:1314:1345:1359:1373:1437:1515:1516:1518:1534:1541:1593:1594:1711:1730:1747:1777:1792:2393:2553:2559:2562:2828:3138:3139:3140:3141:3142:3353:3622:3865:3866:3867:3868:3870:3871:3872:3874:4043:4321:5007:6119:7808:7903:8603:10004:10400:10848:11232:11658:11783:11914:12043:12517:12519:12555:12740:13069:13071:13146:13230:13311:13357:13439:13894:14180:14181:14659:14721:21060:21080:21433:30054:30064:30090:30091,0,RBL:none,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fn,MSBL:0,DNSBL:none,Custom_rules:0:0:0,LFtime:2,LUA_SUMMARY:none X-HE-Tag: vest68_6717e64af557 X-Filterd-Recvd-Size: 2398 Message-ID: <1471885043.3746.60.camel@perches.com> Subject: Re: [PATCH] skx_edac: Move a few hundred bytes to text from data using const From: Joe Perches To: "Luck, Tony" Cc: Doug Thompson , Borislav Petkov , Mauro Carvalho Chehab , linux-edac@vger.kernel.org, linux-kernel@vger.kernel.org Date: Mon, 22 Aug 2016 09:57:23 -0700 In-Reply-To: <20160822164603.GA24307@intel.com> References: <8edda9e0b7357f5177d9f3bb536a71025379f9cb.1471824129.git.joe@perches.com> <20160822164603.GA24307@intel.com> Content-Type: text/plain; charset="ISO-8859-1" X-Mailer: Evolution 3.18.5.2-0ubuntu3 Mime-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 2016-08-22 at 09:46 -0700, Luck, Tony wrote: > On Sun, Aug 21, 2016 at 05:02:41PM -0700, Joe Perches wrote: > > Marking arrays as const makes for smaller data. > Joe, Hi Tony > "a few hundred" seems to be exaggeration. > > Before: > $ size drivers/edac/skx_edac.ko >    text    data     bss     dec     hex filename >    8435    1024      24    9483    250b drivers/edac/skx_edac.ko > > After: > $ size drivers/edac/skx_edac.ko >    text    data     bss     dec     hex filename >    8531     944      24    9499    251b drivers/edac/skx_edac.ko > > so "data" was reduced by 80 bytes, but "text" went up by 96. Yeah, it was a few hundred in an allyesconfig and I neglected to test the defconfig. $ size drivers/edac/skx_edac.o* (x86-64)    text    data     bss     dec     hex filename    6677      64      24    6765    1a6d drivers/edac/skx_edac.o.defconfig.new    6546     176      24    6746    1a5a drivers/edac/skx_edac.o.defconfig.old   20609    5744     320   26673    6831 drivers/edac/skx_edac.o.new   20273    6064     320   26657    6821 drivers/edac/skx_edac.o.old > Net increase of 16 (perhaps because some padding for alignment???) > > Making read-only data const is a good idea in general, but > do we want to do it if it *increases* kernel footprint? Marking all data const that can be const is a good thing. It reduces exposure and eliminates unintentional overwriting.