[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YKQyICQuyJZsl+/j@gmail.com>
Date: Tue, 18 May 2021 14:31:12 -0700
From: Eric Biggers <ebiggers@...nel.org>
To: Arnd Bergmann <arnd@...nel.org>
Cc: Linus Torvalds <torvalds@...ux-foundation.org>,
"Jason A. Donenfeld" <Jason@...c4.com>,
linux-arch <linux-arch@...r.kernel.org>,
Vineet Gupta <vgupta@...opsys.com>,
Russell King <linux@...linux.org.uk>,
Herbert Xu <herbert@...dor.apana.org.au>,
"David S. Miller" <davem@...emloft.net>,
Thomas Bogendoerfer <tsbogend@...ha.franken.de>,
Linux ARM <linux-arm-kernel@...ts.infradead.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
"open list:HARDWARE RANDOM NUMBER GENERATOR CORE"
<linux-crypto@...r.kernel.org>,
"open list:BROADCOM NVRAM DRIVER" <linux-mips@...r.kernel.org>,
Nobuhiro Iwamatsu <iwamatsu@...ian.org>
Subject: Re: [PATCH v2 07/13] asm-generic: unaligned always use struct helpers
On Tue, May 18, 2021 at 10:51:23PM +0200, Arnd Bergmann wrote:
>
> > zstd looks very similar to lz4.
>
> > End result: at a minimum, I'd suggest using
> > "-fno-tree-loop-vectorize", although somebody should check that NEON
> > case.
>
> > And I still think that using O3 for anything halfway complicated
> > should be considered odd and need some strong numbers to enable.
>
> Agreed. I think there is a fairly strong case for just using -O2 on lz4
> and backport that to stable.
> Searching for lz4 bugs with -O3 also finds several reports including
> one that I sent myself:
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65709
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69702
>
> I see that user space zstd is built with -O3 in Debian, but it the changelog
> also lists "Improved : better speed on clang and gcc -O2, thanks to Eric
> Biggers", so maybe Eric has some useful ideas on whether we should
> just use -O2 for the in-kernel version.
>
In my opinion, -O2 is a good default even for compression code. I generally
don't see any benefit from -O3 in compression code I've written.
That being said, -O2 is what I usually use during development. Other people
could write code that relies on -O3 to be optimized well.
The Makefiles for lz4 and zstd use -O3 by default, which is a little concerning.
I do expect that they're still well-written enough to do well with -O2 too, but
it would require doing benchmarks to tell for sure. (As Arnd noted, it happens
that I did do such benchmarks on zstd about 5 years ago, and I found an issue
where some functions weren't marked inline when they should be, causing them to
be inlined at -O3 but not at -O2. That got fixed.)
- Eric
Powered by blists - more mailing lists