From: Joe Perches <joe@perches.com>
To: One Thousand Gnomes <gnomes@lxorguk.ukuu.org.uk>
Cc: David Woodhouse <dwmw2@infradead.org>,
Rusty Russell <rusty@rustcorp.com.au>,
LKML <linux-kernel@vger.kernel.org>,
Quentin Casasnovas <quentin.casasnovas@oracle.com>
Subject: Re: mod_devicetable: Make dmi_strmatch.substr const char *
Date: Tue, 19 May 2015 12:19:22 -0700 [thread overview]
Message-ID: <1432063162.2870.199.camel@perches.com> (raw)
In-Reply-To: <20150519165630.169c64d3@lxorguk.ukuu.org.uk>
On Tue, 2015-05-19 at 16:56 +0100, One Thousand Gnomes wrote:
> On Tue, 19 May 2015 07:46:58 +0100 David Woodhouse <dwmw2@infradead.org> 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 {
next prev parent reply other threads:[~2015-05-19 19:19 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-05-19 0:07 mod_devicetable: Make dmi_strmatch.substr const char * Joe Perches
2015-05-19 6:46 ` David Woodhouse
2015-05-19 15:56 ` One Thousand Gnomes
2015-05-19 19:19 ` Joe Perches [this message]
2015-05-20 5:19 ` Rusty Russell
2015-05-20 7:25 ` Michal Marek
2015-05-20 7:58 ` Joe Perches
2015-05-20 20:31 ` Rusty Russell
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1432063162.2870.199.camel@perches.com \
--to=joe@perches.com \
--cc=dwmw2@infradead.org \
--cc=gnomes@lxorguk.ukuu.org.uk \
--cc=linux-kernel@vger.kernel.org \
--cc=quentin.casasnovas@oracle.com \
--cc=rusty@rustcorp.com.au \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).