Re: [PATCH v2] kbuild: allow setting zstd compression level for modules

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> Masahiro Yamada <masahiroy@xxxxxxxxxx> hat am 06.08.2024 05:29 GMT geschrieben:
> 
>  
> On Fri, May 31, 2024 at 6:13 AM 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>

On a sidenote: I do not use this patch anymore since ages, instead I simply set the preset to "-7" which IMO is a good compromise of speed and compression.

That said, I think we can drop the "-T0" parallel compression, as has recently been done with XZ.

Tor

> 
> 
> 
> Please use:
> 
> $ ZSTD_CLEVEL=N  make modules_install
> 
> 
> I hope this is available widely enough.
> https://github.com/facebook/zstd/commit/6e9512a70cfe099ac6fdf4dda58b61c2e79bbfd9
> 
> 
> 
> 
> > ---
> >  kernel/module/Kconfig    | 8 ++++++++
> >  scripts/Makefile.modinst | 2 +-
> >  2 files changed, 9 insertions(+), 1 deletion(-)
> >
> > diff --git a/kernel/module/Kconfig b/kernel/module/Kconfig
> > index 33a2e991f608..076b18dd3941 100644
> > --- a/kernel/module/Kconfig
> > +++ b/kernel/module/Kconfig
> > @@ -317,6 +317,14 @@ config MODULE_COMPRESS_ZSTD
> >
> >  endchoice
> >
> > +config MODULE_COMPRESS_ZSTD_LEVEL
> > +       int "Compression level (1-19)"
> > +       depends on MODULE_COMPRESS_ZSTD
> > +       range 1 19
> > +       default 3
> > +       help
> > +         Compression level used by zstd for compressing modules.
> > +
> >  config MODULE_DECOMPRESS
> >         bool "Support in-kernel module decompression"
> >         depends on MODULE_COMPRESS_GZIP || MODULE_COMPRESS_XZ || MODULE_COMPRESS_ZSTD
> > diff --git a/scripts/Makefile.modinst b/scripts/Makefile.modinst
> > index ab0c5bd1a60f..480d47eca36a 100644
> > --- a/scripts/Makefile.modinst
> > +++ b/scripts/Makefile.modinst
> > @@ -101,7 +101,7 @@ quiet_cmd_gzip = GZIP    $@
> >  quiet_cmd_xz = XZ      $@
> >        cmd_xz = $(XZ) --lzma2=dict=2MiB -f $<
> >  quiet_cmd_zstd = ZSTD    $@
> > -      cmd_zstd = $(ZSTD) -T0 --rm -f -q $<
> > +      cmd_zstd = $(ZSTD) -$(CONFIG_MODULE_COMPRESS_ZSTD_LEVEL) -T0 --rm -f -q $<
> >
> >  $(dst)/%.ko.gz: $(dst)/%.ko FORCE
> >         $(call cmd,gzip)
> > --
> > 2.42.0
> >
> >
> 
> 
> -- 
> Best Regards
> Masahiro Yamada





[Index of Archives]     [Linux&nblp;USB Development]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite Secrets]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux