On Tue, Aug 6, 2024 at 9:53 AM Miguel Ojeda <miguel.ojeda.sandonis@xxxxxxxxx> wrote: > > On Thu, May 30, 2024 at 11:17 PM Maximilian Bosch <maximilian@xxxxxxxxx> wrote: > > > > From: "torvic9@xxxxxxxxxxx" <torvic9@xxxxxxxxxxx> > > > > Zstd offers a very fine-grained control of compression ratios. > > Add a Kconfig option that allows setting the desired compression > > level for module compression. > > > > Signed-off-by: Tor Vic <torvic9@xxxxxxxxxxx> > > Tested-by: Piotr Gorski <lucjan.lucjanov@xxxxxxxxx> > > Tested-by: Maximilian Bosch <maximilian@xxxxxxxxx> > > Missing Signed-off-by? > > > +config MODULE_COMPRESS_ZSTD_LEVEL > > + int "Compression level (1-19)" > > + depends on MODULE_COMPRESS_ZSTD > > + range 1 19 > > + default 3 > > Zstd supports levels up to 22, as well as "negative" ones (`--fast`), > right? I imagine there is a reason for the 1-19 range, but it would be > nice to mention the rationale. > > Thanks! > > Cheers, > Miguel > Hi, I provided some numbers when using L19 (-19 option) ZSTD for kernel-modules compression (see [1]). The savings is approx. 25MiB for generated Debian linux-image package. The same number in /lib/modules/<kernel-release> - L19 compressed VS. L3 (default) compressed. Details see [1]. What is also to mention: You need a ZSTD version which supports L19 compression and a KMOD version which supports appropriate kernel-decompression routines for this and maybe a Linux-kernel version which has appropriate support from kernel-side. At least there should be a note about user-space and kernel-space requirements - maybe in the KConfig help-text? In the thread below Emil V. had some hints [2], especially now that I understand the ZSTD_CLEVEL info. Thanks Masahiroy: #### Restricted usage of Environment Variables Using environment variables to set compression/decompression parameters has security implications. Therefore, we intentionally restrict its usage. Currently, only `ZSTD_CLEVEL` is supported for setting compression level. If the value of `ZSTD_CLEVEL` is not a valid integer, it will be ignored with a warning message. Note that command line options will override corresponding environment variable settings As a 2nd NOTE: Masahiroy advocated to remove the -T0 multithreading option and offered/demonstrated alternatives (see [3]). If you like you can add for this patch: Tested-by: Sedat Dilek <sedat.dilek@xxxxxxx> # ZSTD compressed kernel-modules with L19 on Linux v6.10.3 AMD64 Thanks. Best regards, -Sedat- Link: https://lore.kernel.org/all/CA+icZUUQadYjAXiCNx7PmKDV20WctvnzkXC3R2F7FM4Gzcm39Q@xxxxxxxxxxxxxx/ [1] Link: https://lore.kernel.org/all/CACvgo52-KbJHUde8kP5-=HdHoCFEcAt=mmy1i=MR7Er7xZz67w@xxxxxxxxxxxxxx/ [2] Link: https://lore.kernel.org/all/CAK7LNASB1qFv1GdxTHvLpcJu1NbWrze5VsfFRYbFMeiFv_JPhQ@xxxxxxxxxxxxxx/ [3] Link: https://github.com/facebook/zstd/commit/6e9512a70cfe099ac6fdf4dda58b61c2e79bbfd9 (Masahiroy)