All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sergey Senozhatsky <senozhatsky@chromium.org>
To: Michal Wilczynski <m.wilczynski@samsung.com>
Cc: Nathan Chancellor <nathan@kernel.org>,
	 Nick Desaulniers <ndesaulniers@google.com>,
	Bill Wendling <morbo@google.com>,
	 Justin Stitt <justinstitt@google.com>,
	Richard Henderson <richard.henderson@linaro.org>,
	 Matt Turner <mattst88@gmail.com>,
	Magnus Lindholm <linmag7@gmail.com>,
	 Russell King <linux@armlinux.org.uk>,
	Thomas Bogendoerfer <tsbogend@alpha.franken.de>,
	 "James E.J. Bottomley" <James.Bottomley@hansenpartnership.com>,
	Helge Deller <deller@gmx.de>, Heiko Carstens <hca@linux.ibm.com>,
	 Vasily Gorbik <gor@linux.ibm.com>,
	Alexander Gordeev <agordeev@linux.ibm.com>,
	 Christian Borntraeger <borntraeger@linux.ibm.com>,
	Sven Schnelle <svens@linux.ibm.com>,
	 Thomas Gleixner <tglx@kernel.org>,
	Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>,
	 Dave Hansen <dave.hansen@linux.intel.com>,
	x86@kernel.org, "H. Peter Anvin" <hpa@zytor.com>,
	 Minchan Kim <minchan@kernel.org>,
	Sergey Senozhatsky <senozhatsky@chromium.org>,
	 Jens Axboe <axboe@kernel.dk>,
	Andrew Morton <akpm@linux-foundation.org>,
	 linux-kernel@vger.kernel.org, llvm@lists.linux.dev,
	linux-alpha@vger.kernel.org,
	 linux-arm-kernel@lists.infradead.org,
	linux-mips@vger.kernel.org, linux-parisc@vger.kernel.org,
	 linux-s390@vger.kernel.org, linux-block@vger.kernel.org,
	 Yann Collet <yann.collet.73@gmail.com>,
	Nick Terrell <terrelln@meta.com>, Gao Xiang <xiang@kernel.org>,
	 Chao Yu <chao@kernel.org>, Jaegeuk Kim <jaegeuk@kernel.org>,
	 Eric Biggers <ebiggers@kernel.org>,
	Herbert Xu <herbert@gondor.apana.org.au>,
	 David Laight <david.laight.linux@gmail.com>,
	Sungguk <sungguk.na@samsung.com>,
	 Jaehoon Chung <jh80.chung@samsung.com>,
	Marek Szyprowski <m.szyprowski@samsung.com>,
	 linux-erofs@lists.ozlabs.org,
	linux-f2fs-devel@lists.sourceforge.net,
	 linux-crypto@vger.kernel.org, linux-mm@kvack.org,
	linux-doc@vger.kernel.org,  Jonathan Corbet <corbet@lwn.net>,
	"S. Biplab Raut" <Biplab.Raut@amd.com>
Subject: Re: [PATCH v3 13/18] zram: lz4hc: compress levels above 9 as level 9
Date: Thu, 3 Dec 2026 11:26:46 +0900	[thread overview]
Message-ID: <axDTLreo7yRoRPrp@google.com> (raw)
In-Reply-To: <20261202-lz4-vendor-upstream-v3-13-a53bffa82fbb@samsung.com>

On (26/12/02 18:32), Michal Wilczynski wrote:
[..]
> +++ b/drivers/block/zram/backend_lz4hc.c
> @@ -36,6 +36,16 @@ static int lz4hc_setup_params(struct zcomp_params *params)
>  		 */
>  		pr_err("invalid compression level %d\n", params->level);
>  		return -EINVAL;
> +	} else if (params->level >= LZ4HC_OPT_MIN_CLEVEL) {
> +		/*
> +		 * These levels select LZ4's optimal parser, which on a page
> +		 * compresses 2-5 times slower than level 9 for well under
> +		 * 1% smaller output.  It suits data compressed once and
> +		 * read many times, not swap.
> +		 */
> +		pr_info("level %d compresses as level %d\n", params->level,
> +			LZ4HC_OPT_MIN_CLEVEL - 1);
> +		params->level = LZ4HC_OPT_MIN_CLEVEL - 1;
>  	}

My preference would be to just return an error.  We should not correct
"bad" user input.

WARNING: multiple messages have this Message-ID (diff)
From: Sergey Senozhatsky <senozhatsky@chromium.org>
To: Michal Wilczynski <m.wilczynski@samsung.com>
Cc: linux-doc@vger.kernel.org,
	Dave Hansen <dave.hansen@linux.intel.com>,
	linux-mips@vger.kernel.org,
	"James E.J. Bottomley" <James.Bottomley@hansenpartnership.com>,
	linux-mm@kvack.org, Bill Wendling <morbo@google.com>,
	"H. Peter Anvin" <hpa@zytor.com>,
	Alexander Gordeev <agordeev@linux.ibm.com>,
	Sungguk <sungguk.na@samsung.com>,
	Marek Szyprowski <m.szyprowski@samsung.com>,
	linux-s390@vger.kernel.org,
	Herbert Xu <herbert@gondor.apana.org.au>,
	Magnus Lindholm <linmag7@gmail.com>, Helge Deller <deller@gmx.de>,
	x86@kernel.org, Russell King <linux@armlinux.org.uk>,
	Eric Biggers <ebiggers@kernel.org>,
	Ingo Molnar <mingo@redhat.com>,
	Yann Collet <yann.collet.73@gmail.com>,
	Matt Turner <mattst88@gmail.com>,
	Christian Borntraeger <borntraeger@linux.ibm.com>,
	"S. Biplab Raut" <Biplab.Raut@amd.com>,
	Sven Schnelle <svens@linux.ibm.com>,
	llvm@lists.linux.dev, Vasily Gorbik <gor@linux.ibm.com>,
	Sergey Senozhatsky <senozhatsky@chromium.org>,
	Heiko Carstens <hca@linux.ibm.com>,
	linux-alpha@vger.kernel.org,
	Richard Henderson <richard.henderson@linaro.org>,
	linux-crypto@vger.kernel.org,
	Nathan Chancellor <nathan@kernel.org>,
	Nick Terrell <terrelln@meta.com>, Borislav Petkov <bp@alien8.de>,
	Jaegeuk Kim <jaegeuk@kernel.org>, Gao Xiang <xiang@kernel.org>,
	linux-arm-kernel@lists.infradead.org,
	Jens Axboe <axboe@kernel.dk>,
	linux-block@vger.kernel.org,
	Thomas Bogendoerfer <tsbogend@alpha.franken.de>,
	linux-parisc@vger.kernel.org, Jonathan Corbet <corbet@lwn.net>,
	Nick Desaulniers <ndesaulniers@google.com>,
	linux-kernel@vger.kernel.org,
	linux-f2fs-devel@lists.sourceforge.net,
	Minchan Kim <minchan@kernel.org>,
	Thomas Gleixner <tglx@kernel.org>,
	Justin Stitt <justinstitt@google.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	linux-erofs@lists.ozlabs.org,
	David Laight <david.laight.linux@gmail.com>
Subject: Re: [f2fs-dev] [PATCH v3 13/18] zram: lz4hc: compress levels above 9 as level 9
Date: Thu, 3 Dec 2026 11:26:46 +0900	[thread overview]
Message-ID: <axDTLreo7yRoRPrp@google.com> (raw)
In-Reply-To: <20261202-lz4-vendor-upstream-v3-13-a53bffa82fbb@samsung.com>

On (26/12/02 18:32), Michal Wilczynski wrote:
[..]
> +++ b/drivers/block/zram/backend_lz4hc.c
> @@ -36,6 +36,16 @@ static int lz4hc_setup_params(struct zcomp_params *params)
>  		 */
>  		pr_err("invalid compression level %d\n", params->level);
>  		return -EINVAL;
> +	} else if (params->level >= LZ4HC_OPT_MIN_CLEVEL) {
> +		/*
> +		 * These levels select LZ4's optimal parser, which on a page
> +		 * compresses 2-5 times slower than level 9 for well under
> +		 * 1% smaller output.  It suits data compressed once and
> +		 * read many times, not swap.
> +		 */
> +		pr_info("level %d compresses as level %d\n", params->level,
> +			LZ4HC_OPT_MIN_CLEVEL - 1);
> +		params->level = LZ4HC_OPT_MIN_CLEVEL - 1;
>  	}

My preference would be to just return an error.  We should not correct
"bad" user input.


_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

  reply	other threads:[~2026-12-03  2:26 UTC|newest]

Thread overview: 43+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20261202173344eucas1p2391f624bfb2029b6da47212f5be17c65@eucas1p2.samsung.com>
2026-12-02 17:32 ` [PATCH v3 00/18] lib/lz4: stop forking upstream LZ4, vendor it instead Michal Wilczynski
2026-12-02 17:32   ` [f2fs-dev] " Michal Wilczynski
2026-12-02 17:32   ` [PATCH v3 01/18] lib/decompress_unlz4: use LZ4_decompress_safe() before boot Michal Wilczynski
2026-12-02 17:32     ` [f2fs-dev] " Michal Wilczynski
2026-12-02 17:32   ` [PATCH v3 02/18] lib/lz4: remove LZ4_decompress_fast() and its variants Michal Wilczynski
2026-12-02 17:32     ` [f2fs-dev] " Michal Wilczynski
2026-12-02 17:32   ` [PATCH v3 03/18] lib/lz4: add lz4hc_mem_compress() Michal Wilczynski
2026-12-02 17:32     ` [f2fs-dev] " Michal Wilczynski
2026-12-02 17:32   ` [PATCH v3 04/18] zram: lz4/lz4hc: size the streams by the library's constants Michal Wilczynski
2026-12-02 17:32     ` [f2fs-dev] " Michal Wilczynski
2026-12-03  2:41     ` Sergey Senozhatsky
2026-12-03  2:41       ` [f2fs-dev] " Sergey Senozhatsky
2026-12-02 17:32   ` [PATCH v3 05/18] f2fs: size the lz4hc context by the compression level Michal Wilczynski
2026-12-02 17:32     ` [f2fs-dev] " Michal Wilczynski
2026-12-02 17:32   ` [PATCH v3 06/18] lib/lz4: import upstream LZ4 sources verbatim Michal Wilczynski
2026-12-02 17:32     ` [f2fs-dev] " Michal Wilczynski
2026-12-02 17:32   ` [PATCH v3 07/18] lib/lz4: add the build environment for the vendored sources Michal Wilczynski
2026-12-02 17:32     ` [f2fs-dev] " Michal Wilczynski
2026-12-02 17:32   ` [PATCH v3 08/18] arch: boot: put the LZ4 freestanding headers on the decompressor path Michal Wilczynski
2026-12-02 17:32     ` [f2fs-dev] " Michal Wilczynski
2026-12-02 17:32   ` [PATCH v3 09/18] lib/lz4: switch the compressor to the vendored sources Michal Wilczynski
2026-12-02 17:32     ` [f2fs-dev] " Michal Wilczynski
2026-12-02 17:32   ` [f2fs-dev] [PATCH v3 10/18] lib/lz4: switch the HC " Michal Wilczynski
2026-12-02 17:32     ` Michal Wilczynski
2026-12-02 17:32   ` [PATCH v3 11/18] lib/lz4: switch the decompressor " Michal Wilczynski
2026-12-02 17:32     ` [f2fs-dev] " Michal Wilczynski
2026-12-02 17:32   ` [f2fs-dev] [PATCH v3 12/18] lib/lz4: replace lz4_kernel_api.h's prototypes with <linux/lz4.h> Michal Wilczynski
2026-12-02 17:32     ` Michal Wilczynski
2026-12-02 17:32   ` [f2fs-dev] [PATCH v3 13/18] zram: lz4hc: compress levels above 9 as level 9 Michal Wilczynski
2026-12-02 17:32     ` Michal Wilczynski
2026-12-03  2:26     ` Sergey Senozhatsky [this message]
2026-12-03  2:26       ` [f2fs-dev] " Sergey Senozhatsky
2026-12-02 17:32   ` [f2fs-dev] [PATCH v3 14/18] lib/lz4: add KUnit tests for compression and decompression Michal Wilczynski
2026-12-02 17:32     ` Michal Wilczynski
2026-12-02 17:32   ` [f2fs-dev] [PATCH v3 15/18] MAINTAINERS: add an entry for the LZ4 compression library Michal Wilczynski
2026-12-02 17:32     ` Michal Wilczynski
2026-12-02 17:33   ` [f2fs-dev] [PATCH v3 16/18] lib/lz4: take lz4 PR #2216's lz4hc hash chain search speedup Michal Wilczynski
2026-12-02 17:33     ` Michal Wilczynski
2026-12-02 17:33   ` [f2fs-dev] [PATCH v3 17/18] lib/lz4: take lz4 PR #2217's LZ4HC_PATTERN_ANALYSIS build macro Michal Wilczynski
2026-12-02 17:33     ` Michal Wilczynski
2026-12-02 17:33   ` [f2fs-dev] [PATCH v3 18/18] lib/lz4: leave out lz4hc pattern analysis Michal Wilczynski
2026-12-02 17:33     ` Michal Wilczynski
2026-12-02 17:44   ` [PATCH v3 00/18] lib/lz4: stop forking upstream LZ4, vendor it instead sashiko-bot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=axDTLreo7yRoRPrp@google.com \
    --to=senozhatsky@chromium.org \
    --cc=Biplab.Raut@amd.com \
    --cc=James.Bottomley@hansenpartnership.com \
    --cc=agordeev@linux.ibm.com \
    --cc=akpm@linux-foundation.org \
    --cc=axboe@kernel.dk \
    --cc=borntraeger@linux.ibm.com \
    --cc=bp@alien8.de \
    --cc=chao@kernel.org \
    --cc=corbet@lwn.net \
    --cc=dave.hansen@linux.intel.com \
    --cc=david.laight.linux@gmail.com \
    --cc=deller@gmx.de \
    --cc=ebiggers@kernel.org \
    --cc=gor@linux.ibm.com \
    --cc=hca@linux.ibm.com \
    --cc=herbert@gondor.apana.org.au \
    --cc=hpa@zytor.com \
    --cc=jaegeuk@kernel.org \
    --cc=jh80.chung@samsung.com \
    --cc=justinstitt@google.com \
    --cc=linmag7@gmail.com \
    --cc=linux-alpha@vger.kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-crypto@vger.kernel.org \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-erofs@lists.ozlabs.org \
    --cc=linux-f2fs-devel@lists.sourceforge.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mips@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=linux-parisc@vger.kernel.org \
    --cc=linux-s390@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=llvm@lists.linux.dev \
    --cc=m.szyprowski@samsung.com \
    --cc=m.wilczynski@samsung.com \
    --cc=mattst88@gmail.com \
    --cc=minchan@kernel.org \
    --cc=mingo@redhat.com \
    --cc=morbo@google.com \
    --cc=nathan@kernel.org \
    --cc=ndesaulniers@google.com \
    --cc=richard.henderson@linaro.org \
    --cc=sungguk.na@samsung.com \
    --cc=svens@linux.ibm.com \
    --cc=terrelln@meta.com \
    --cc=tglx@kernel.org \
    --cc=tsbogend@alpha.franken.de \
    --cc=x86@kernel.org \
    --cc=xiang@kernel.org \
    --cc=yann.collet.73@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.