Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1685490

Re: [PATCH v2 3/4] btrfs: Add zstd support

From Adam Borowski <kilobyte@angband.pl>
Newsgroups linux.kernel
Subject Re: [PATCH v2 3/4] btrfs: Add zstd support
Date 2017-07-12 05:40 +0200
Message-ID <u2gFk-2Ld-11@gated-at.bofh.it> (permalink)
References (4 earlier) <u0Lax-2HY-7@gated-at.bofh.it> <u0Oi5-57m-1@gated-at.bofh.it> <u1G8P-53s-39@gated-at.bofh.it> <u1Vrc-68T-17@gated-at.bofh.it> <u1WwV-74G-9@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Tue, Jul 11, 2017 at 06:01:38AM +0000, Nick Terrell wrote:
> On 7/10/17, 9:57 PM, "Nick Terrell" <terrelln@fb.com> wrote:
> > The problem is caused by a gcc-7 bug [1]. It miscompiles
> > ZSTD_wildcopy(void *dst, void const *src, ptrdiff_t len) when len is 0.
>
> Sorry, my patch still triggered the gcc bug, I used the wrong compiler.
> This patch works, and runs about the same speed as before the patch for
> small inputs, and slightly faster for larger inputs (100+ bytes). I'll
> look for a faster workaround if benchmarks show it matters.

Confirmed, the fix stops the crash for me.  Yay!

> --- a/lib/zstd/zstd_internal.h
> +++ b/lib/zstd/zstd_internal.h
> @@ -139,12 +139,8 @@ static void ZSTD_copy8(void *dst, const void *src) { memcpy(dst, src, 8); }
>  #define WILDCOPY_OVERLENGTH 8
>  ZSTD_STATIC void ZSTD_wildcopy(void *dst, const void *src, ptrdiff_t length)
>  {
> -	const BYTE *ip = (const BYTE *)src;
> -	BYTE *op = (BYTE *)dst;
> -	BYTE *const oend = op + length;
> -	do
> -		COPY8(op, ip)
> -	while (op < oend);
> +	if (length > 0)
> +		memcpy(dst, src, length);
>  }
>  
>  ZSTD_STATIC void ZSTD_wildcopy_e(void *dst, const void *src, void *dstEnd) /* should be faster for decoding, but strangely, not verified on all platform */

-- 
⢀⣴⠾⠻⢶⣦⠀ 
⣾⠁⢠⠒⠀⣿⡁ A dumb species has no way to open a tuna can.
⢿⡄⠘⠷⠚⠋⠀ A smart species invents a can opener.
⠈⠳⣄⠀⠀⠀⠀ A master species delegates.

Back to linux.kernel | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

Re: [PATCH v2 3/4] btrfs: Add zstd support Adam Borowski <kilobyte@angband.pl> - 2017-07-06 18:40 +0200
  Re: [PATCH v2 3/4] btrfs: Add zstd support Nick Terrell <terrelln@fb.com> - 2017-07-08 01:20 +0200
    Re: [PATCH v2 3/4] btrfs: Add zstd support Adam Borowski <kilobyte@angband.pl> - 2017-07-08 01:50 +0200
      Re: [PATCH v2 3/4] btrfs: Add zstd support Adam Borowski <kilobyte@angband.pl> - 2017-07-08 05:10 +0200
        Re: [PATCH v2 3/4] btrfs: Add zstd support "Austin S. Hemmelgarn" <ahferroin7@gmail.com> - 2017-07-10 14:40 +0200
          Re: [PATCH v2 3/4] btrfs: Add zstd support Nick Terrell <terrelln@fb.com> - 2017-07-10 23:00 +0200
          Re: [PATCH v2 3/4] btrfs: Add zstd support Nick Terrell <terrelln@fb.com> - 2017-07-11 07:00 +0200
            Re: [PATCH v2 3/4] btrfs: Add zstd support Nick Terrell <terrelln@fb.com> - 2017-07-11 08:10 +0200
              Re: [PATCH v2 3/4] btrfs: Add zstd support Adam Borowski <kilobyte@angband.pl> - 2017-07-12 05:40 +0200

csiph-web