Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751018AbbESTT1 (ORCPT ); Tue, 19 May 2015 15:19:27 -0400 Received: from smtprelay0177.hostedemail.com ([216.40.44.177]:41561 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1750734AbbESTT0 (ORCPT ); Tue, 19 May 2015 15:19:26 -0400 X-Session-Marker: 6A6F6540706572636865732E636F6D X-Spam-Summary: 2,0,0,,d41d8cd98f00b204,joe@perches.com,:::::::::,RULES_HIT:41:355:379:541:599:800:960:973:988:989:1042:1260:1277:1311:1313:1314:1345:1359:1373:1437:1515:1516:1518:1534:1542:1593:1594:1711:1730:1747:1777:1792:2197:2199:2393:2553:2559:2562:2828:2895:3138:3139:3140:3141:3142:3354:3622:3865:3866:3867:3870:3871:3872:3874:4321:4560:4605:4837:5007:6119:6261:7602:7809:7903:8603:10004:10400:10459:10848:10967:11026:11232:11473:11658:11914:12043:12296:12517:12519:12555:12679:12711:12737:12740:13161:13229:13548:13870:21080,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 X-HE-Tag: space16_17da473727126 X-Filterd-Recvd-Size: 3702 Message-ID: <1432063162.2870.199.camel@perches.com> Subject: Re: mod_devicetable: Make dmi_strmatch.substr const char * From: Joe Perches To: One Thousand Gnomes Cc: David Woodhouse , Rusty Russell , LKML , Quentin Casasnovas Date: Tue, 19 May 2015 12:19:22 -0700 In-Reply-To: <20150519165630.169c64d3@lxorguk.ukuu.org.uk> References: <1431994055.2870.102.camel@perches.com> <1432018018.3277.22.camel@infradead.org> <20150519165630.169c64d3@lxorguk.ukuu.org.uk> Content-Type: text/plain; charset="ISO-8859-1" X-Mailer: Evolution 3.12.11-0ubuntu3 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2871 Lines: 81 On Tue, 2015-05-19 at 16:56 +0100, One Thousand Gnomes wrote: > On Tue, 19 May 2015 07:46:58 +0100 David Woodhouse wrote: > > On Mon, 2015-05-18 at 17:07 -0700, Joe Perches wrote: > > > changed dmi_strmatch.substr from char * to char[79]; > > > > > > Changing it back to const char * would shrink an x86-64 > > > defconfig more than 100KB. > > > > > > $ size vmlinux.old vmlinux.new > > > text data bss dec hex filename > > > 11941725 1825624 1085440 14852789 e2a2b5 vmlinux.old > > > 11921172 1730648 1085440 14737260 e0df6c vmlinux.new > > What percentage of those are __initdata ? old: 17 .init.data 000876b0 ffffffff81f9e000 0000000001f9e000 0139e000 2**12 new: 17 .init.data 000711b0 ffffffff81f9d000 0000000001f9d000 0139d000 2**12 .init.data: 0x876b0 - 0x711b0 = 0x16500 (91392) vmlinux: 14852789 - 14737260 = 115529 so there's ~25KB delta that's not .init.data. The longest DMI_MATCH substr I found was 40 chars, so there's some value in reducing the substr size of 79 to something shorter like 47 to reduce 80*4=320 to 48*4=192 per use. $ grep-2.5.4 -rP --include=*.[ch] "\bDMI_(?:EXACT_)?MATCH\s*\(\s*\w+\s*,\s*\"[^\"]*" *| \ grep -oh '"[^"]*"' | \ sed 's/"//g' | sort | uniq | \ awk '{print length($0), " ", $0}'| \ sort -rn | head -10 39 Matsushita Electric Industrial Co.,Ltd. 35 ASUS PR-DLS ACPI BIOS Revision 1010 34 Micro-Star International Co., Ltd. 34 Award Software International, Inc. 34 900X3C/900X3D/900X3E/900X4C/900X4D 34 370R4E/370R4V/370R5E/3570RE/370R5V 33 MICRO-STAR INTERNATIONAL CO., LTD 32 MV85010A.86A.0016.P07.0201251536 32 MO81010A.86A.0008.P04.0004170800 32 ASUS A7V ACPI BIOS Revision 1007 Changing substr from 79 to 47 reduces .init.data a bit (different -next version) old: 17 .init.data 00081718 ffffffff81f84000 0000000001f84000 01384000 2**12 new: 17 .init.data 00076598 ffffffff81f84000 0000000001f84000 01384000 2**12 .init.data: 0x81718 - 0x76598 = 0xb180 (45440) Unless/until modpost is updated, maybe this patch is OK: --- include/linux/mod_devicetable.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/include/linux/mod_devicetable.h b/include/linux/mod_devicetable.h index 3bfd567..279f1be 100644 --- a/include/linux/mod_devicetable.h +++ b/include/linux/mod_devicetable.h @@ -462,7 +462,11 @@ enum dmi_field { struct dmi_strmatch { unsigned char slot:7; unsigned char exact_match:1; - char substr[79]; +#ifdef CONFIG_MODULES + char substr[47]; +#else + const char *substr; +#endif }; struct dmi_system_id { -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/