linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] zstd: Fix decompression of large window archives on 32-bit platforms
@ 2020-09-14  6:19 Petr Malat
  2020-09-14 19:14 ` Nick Terrell
  0 siblings, 1 reply; 2+ messages in thread
From: Petr Malat @ 2020-09-14  6:19 UTC (permalink / raw)
  To: linux-kernel; +Cc: nickrterrell, gustavoars, Petr Malat

It seems some optimization has been removed from the code without removing
the if condition which should activate it only on 64-bit platforms and as
a result the code responsible for decompression with window larger than
8MB was disabled on 32-bit platforms.

Signed-off-by: Petr Malat <oss@malat.biz>
---
 lib/zstd/decompress.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/lib/zstd/decompress.c b/lib/zstd/decompress.c
index db6761ea4deb..509a3b8d51b9 100644
--- a/lib/zstd/decompress.c
+++ b/lib/zstd/decompress.c
@@ -1457,12 +1457,8 @@ static size_t ZSTD_decompressBlock_internal(ZSTD_DCtx *dctx, void *dst, size_t d
 		ip += litCSize;
 		srcSize -= litCSize;
 	}
-	if (sizeof(size_t) > 4) /* do not enable prefetching on 32-bits x86, as it's performance detrimental */
-				/* likely because of register pressure */
-				/* if that's the correct cause, then 32-bits ARM should be affected differently */
-				/* it would be good to test this on ARM real hardware, to see if prefetch version improves speed */
-		if (dctx->fParams.windowSize > (1 << 23))
-			return ZSTD_decompressSequencesLong(dctx, dst, dstCapacity, ip, srcSize);
+	if (dctx->fParams.windowSize > (1 << 23))
+		return ZSTD_decompressSequencesLong(dctx, dst, dstCapacity, ip, srcSize);
 	return ZSTD_decompressSequences(dctx, dst, dstCapacity, ip, srcSize);
 }
 
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] zstd: Fix decompression of large window archives on 32-bit platforms
  2020-09-14  6:19 [PATCH] zstd: Fix decompression of large window archives on 32-bit platforms Petr Malat
@ 2020-09-14 19:14 ` Nick Terrell
  0 siblings, 0 replies; 2+ messages in thread
From: Nick Terrell @ 2020-09-14 19:14 UTC (permalink / raw)
  To: Petr Malat; +Cc: linux-kernel, gustavoars, Nick Terrell

On Sun, Sep 13, 2020 at 11:19 PM Petr Malat <oss@malat.biz> wrote:
>
> It seems some optimization has been removed from the code without removing
> the if condition which should activate it only on 64-bit platforms and as
> a result the code responsible for decompression with window larger than
> 8MB was disabled on 32-bit platforms.
>
> Signed-off-by: Petr Malat <oss@malat.biz>

Reviewed-by: Nick Terrell <terrelln@fb.com>

Thanks for the fix! I looked upstream and this fix corresponds to this
upstream commit:
https://github.com/facebook/zstd/commit/8a5c0c98ae5a7884694589d7a69bc99011add94d

Thanks,
Nick Terrell

> ---
>  lib/zstd/decompress.c | 8 ++------
>  1 file changed, 2 insertions(+), 6 deletions(-)
>
> diff --git a/lib/zstd/decompress.c b/lib/zstd/decompress.c
> index db6761ea4deb..509a3b8d51b9 100644
> --- a/lib/zstd/decompress.c
> +++ b/lib/zstd/decompress.c
> @@ -1457,12 +1457,8 @@ static size_t ZSTD_decompressBlock_internal(ZSTD_DCtx *dctx, void *dst, size_t d
>                 ip += litCSize;
>                 srcSize -= litCSize;
>         }
> -       if (sizeof(size_t) > 4) /* do not enable prefetching on 32-bits x86, as it's performance detrimental */
> -                               /* likely because of register pressure */
> -                               /* if that's the correct cause, then 32-bits ARM should be affected differently */
> -                               /* it would be good to test this on ARM real hardware, to see if prefetch version improves speed */
> -               if (dctx->fParams.windowSize > (1 << 23))
> -                       return ZSTD_decompressSequencesLong(dctx, dst, dstCapacity, ip, srcSize);
> +       if (dctx->fParams.windowSize > (1 << 23))
> +               return ZSTD_decompressSequencesLong(dctx, dst, dstCapacity, ip, srcSize);
>         return ZSTD_decompressSequences(dctx, dst, dstCapacity, ip, srcSize);
>  }
>
> --
> 2.20.1
>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-09-14 19:15 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-14  6:19 [PATCH] zstd: Fix decompression of large window archives on 32-bit platforms Petr Malat
2020-09-14 19:14 ` Nick Terrell

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).