Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1737865
| From | Arnd Bergmann <arnd@arndb.de> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH] lib/lz4: make arrays static const, reduces object code size |
| Date | 2017-09-22 23:40 +0200 |
| Message-ID | <usDPX-2NY-7@gated-at.bofh.it> (permalink) |
| References | (1 earlier) <usiLv-77w-11@gated-at.bofh.it> <usiVb-7aA-5@gated-at.bofh.it> <usqSK-3or-13@gated-at.bofh.it> <uszW1-rP-1@gated-at.bofh.it> <usBEt-1vD-13@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On Fri, Sep 22, 2017 at 9:17 PM, Arnd Bergmann <arnd@arndb.de> wrote:
> On Fri, Sep 22, 2017 at 7:21 PM, Joe Perches <joe@perches.com> wrote:
>> On Fri, 2017-09-22 at 09:48 +0200, Arnd Bergmann wrote:
>>> On Fri, Sep 22, 2017 at 1:11 AM, Colin Ian King
>
>>> text data bss dec hex filename
>>> 18220 176 0 18396 47dc build/tmp/lib/lz4/lz4_decompress-after.o
>>> 22297 0 0 22297 5719 build/tmp/lib/lz4/lz4_decompress-before.o
>>
>> Perhaps not so much a gcc bug as an opportunity
>> for gcc to add an additional optimization.
>>
>> gcc would have to verify that the const array is
>> not initialized with some variable or argument like:
>>
>> int foo(int a)
>> {
>> const int array[] = {1, a};
>> ...
>> }
>
> It depends. With a 10KB different in .text size, my guess is that this
> is a case where gcc does the right optimization in principle, but
> fails to do what was intended in some corner cases.
I found the problem: "gcc -fsanitze=kernel-address --param asan-stack=1"
produces lots of expensive checks here with gcc-5 or higher.
Disabling it makes a big difference:
upstream:
gcc-7.0.0 --fsanitze=kernel-address --param asan-stack=1: 31789 bytes
gcc-7.0.0: 16535 bytes
patched:
gcc-7.0.0 --fsanitze=kernel-address --param asan-stack=1: 20351 bytes
gcc-7.0.0: 14490 bytes
Arnd
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH] lib/lz4: make arrays static const, reduces object code size Colin King <colin.king@canonical.com> - 2017-09-22 00:20 +0200
Re: [PATCH] lib/lz4: make arrays static const, reduces object code size Christophe JAILLET <christophe.jaillet@wanadoo.fr> - 2017-09-22 01:10 +0200
Re: [PATCH] lib/lz4: make arrays static const, reduces object code size Colin Ian King <colin.king@canonical.com> - 2017-09-22 01:20 +0200
Re: [PATCH] lib/lz4: make arrays static const, reduces object code size Arnd Bergmann <arnd@arndb.de> - 2017-09-22 09:50 +0200
Re: [PATCH] lib/lz4: make arrays static const, reduces object code size Joe Perches <joe@perches.com> - 2017-09-22 19:30 +0200
Re: [PATCH] lib/lz4: make arrays static const, reduces object code size Arnd Bergmann <arnd@arndb.de> - 2017-09-22 21:20 +0200
Re: [PATCH] lib/lz4: make arrays static const, reduces object code size Arnd Bergmann <arnd@arndb.de> - 2017-09-22 21:40 +0200
Re: [PATCH] lib/lz4: make arrays static const, reduces object code size Arnd Bergmann <arnd@arndb.de> - 2017-09-22 23:40 +0200
Re: [PATCH] lib/lz4: make arrays static const, reduces object code size Colin Ian King <colin.king@canonical.com> - 2017-09-22 23:50 +0200
Re: [PATCH] lib/lz4: make arrays static const, reduces object code size Joe Perches <joe@perches.com> - 2017-09-23 03:40 +0200
Re: [PATCH] lib/lz4: make arrays static const, reduces object code size Joe Perches <joe@perches.com> - 2017-09-23 03:40 +0200
csiph-web