diff options
author | Nick Terrell <terrelln@fb.com> | 2020-07-30 12:08:34 -0700 |
---|---|---|
committer | Ingo Molnar <mingo@kernel.org> | 2020-07-31 11:49:07 +0200 |
commit | 6d25a633ea68a103c7293d16eb69a7d4689075ad (patch) | |
tree | fb92c50c613e17641519af0d27a5a098707dc4a9 /lib/zstd/fse_decompress.c | |
parent | 92ed301919932f777713b9172e525674157e983d (diff) | |
download | linux-6d25a633ea68a103c7293d16eb69a7d4689075ad.tar.gz linux-6d25a633ea68a103c7293d16eb69a7d4689075ad.tar.bz2 linux-6d25a633ea68a103c7293d16eb69a7d4689075ad.zip |
lib: Prepare zstd for preboot environment, improve performance
These changes are necessary to get the build to work in the preboot
environment, and to get reasonable performance:
- Remove a double definition of the CHECK_F macro when the zstd
library is amalgamated.
- Switch ZSTD_copy8() to __builtin_memcpy(), because in the preboot
environment on x86 gcc can't inline `memcpy()` otherwise.
- Limit the gcc hack in ZSTD_wildcopy() to the broken gcc version. See
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81388.
ZSTD_copy8() and ZSTD_wildcopy() are in the core of the zstd hot loop.
So outlining these calls to memcpy(), and having an extra branch are very
detrimental to performance.
Signed-off-by: Nick Terrell <terrelln@fb.com>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Tested-by: Sedat Dilek <sedat.dilek@gmail.com>
Reviewed-by: Kees Cook <keescook@chromium.org>
Link: https://lore.kernel.org/r/20200730190841.2071656-2-nickrterrell@gmail.com
Diffstat (limited to 'lib/zstd/fse_decompress.c')
-rw-r--r-- | lib/zstd/fse_decompress.c | 9 |
1 files changed, 1 insertions, 8 deletions
diff --git a/lib/zstd/fse_decompress.c b/lib/zstd/fse_decompress.c index a84300e5a013..0b353530fb3f 100644 --- a/lib/zstd/fse_decompress.c +++ b/lib/zstd/fse_decompress.c @@ -47,6 +47,7 @@ ****************************************************************/ #include "bitstream.h" #include "fse.h" +#include "zstd_internal.h" #include <linux/compiler.h> #include <linux/kernel.h> #include <linux/string.h> /* memcpy, memset */ @@ -60,14 +61,6 @@ enum { FSE_static_assert = 1 / (int)(!!(c)) }; \ } /* use only *after* variable declarations */ -/* check and forward error code */ -#define CHECK_F(f) \ - { \ - size_t const e = f; \ - if (FSE_isError(e)) \ - return e; \ - } - /* ************************************************************** * Templates ****************************************************************/ |