From: Thomas Gleixner <tglx@linutronix.de>
To: Denys Vlasenko <dvlasenk@redhat.com>
Cc: Herbert Xu <herbert@gondor.apana.org.au>,
Josh Poimboeuf <jpoimboe@redhat.com>,
Xiaodong Liu <xiaodong.liu@intel.com>,
Megha Dey <megha.dey@intel.com>,
linux-crypto@vger.kernel.org, x86@kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] x86/crypto: make constants readonly, allow linker to merge them
Date: Fri, 20 Jan 2017 00:09:13 +0100 (CET) [thread overview]
Message-ID: <alpine.DEB.2.20.1701200006100.5358@nanos> (raw)
In-Reply-To: <20170119213304.18140-1-dvlasenk@redhat.com>
On Thu, 19 Jan 2017, Denys Vlasenko wrote:
> A lot of asm-optimized routines in arch/x86/crypto/ keep its
> constants in .data. This is wrong, they should be on .rodata.
>
> Mnay of these constants are the same in different modules.
> For example, 128-bit shuffle mask 0x000102030405060708090A0B0C0D0E0F
> exists in at least half a dozen places.
>
> There is a way to let linker merge them and use just one copy.
> The rules are as follows: mergeable objects of different sizes
> should not share sections. You can't put them all in one .rodata
> section, they will lose "mergeability".
>
> GCC puts its mergeable constants in ".rodata.cstSIZE" sections,
> or ".rodata.cstSIZE.<object_name>" if -fdata-sections is used.
> This patch does the same:
>
> .section .rodata.cst16.SHUF_MASK, "aM", @progbits, 16
>
> It is important that all data in such section consists of
> 16-byte elements, not larger ones, and there are no implicit
> use of one element from another.
>
> When this is not the case, use non-mergeable section:
>
> .section .rodata[.VAR_NAME], "a", @progbits
>
> This reduces .data by ~15 kbytes:
>
> text data bss dec hex filename
> 11097415 2705840 2630712 16433967 fac32f vmlinux-prev.o
> 11112095 2690672 2630712 16433479 fac147 vmlinux.o
And at the same time it increases text size by ~15k. The overall change in
total size is 488 byte reduction. Weird.
Thanks,
tglx
next prev parent reply other threads:[~2017-01-19 23:09 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-01-19 21:33 [PATCH] x86/crypto: make constants readonly, allow linker to merge them Denys Vlasenko
2017-01-19 23:09 ` Thomas Gleixner [this message]
2017-01-23 15:21 ` Denys Vlasenko
2017-01-23 15:00 ` Herbert Xu
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=alpine.DEB.2.20.1701200006100.5358@nanos \
--to=tglx@linutronix.de \
--cc=dvlasenk@redhat.com \
--cc=herbert@gondor.apana.org.au \
--cc=jpoimboe@redhat.com \
--cc=linux-crypto@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=megha.dey@intel.com \
--cc=x86@kernel.org \
--cc=xiaodong.liu@intel.com \
/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).