Re: [PATCH v3 20/20] kbuild: compress the kernel with pigz if available
From: Manuel Ebner
Date: Fri Sep 18 2026 - 11:34:04 EST
Hi Lorenzo,
On Thu, 2026-09-17 at 17:06 +0100, Lorenzo Stoakes (ARM) wrote:
> The gzip step of a kernel build is very lengthy, especially for larger
> builds such as allmodconfig.
>
> ...
>
> Whole build, 128-thread Threadripper 9980X, best of N runs:
>
> before after delta
> -------------------------------
> x86 defconfig, touch mm/vma.c, gcc 7.7s 6.0s -1.7s (-22%)
> x86 defconfig, touch mm/vma.c, clang 6.9s 5.4s -1.5s (-21%)
> x86 defconfig, clean, gcc 28.2s 26.3s -1.8s (-6%)
> x86 defconfig, clean, clang 28.7s 27.2s -1.5s (-5%)
> x86 allmodconfig, touch mm/vma.c, gcc 23.7s 15.4s -8.3s (-35%)
> x86 allmodconfig, touch mm/vma.c, clang 22.5s 15.6s -7.0s (-31%)
> x86 allmodconfig, clean, gcc 294.1s 278.6s -15.5s (-5%)
> x86 allmodconfig, clean, clang 283.9s 266.8s -17.1s (-6%)
That's good to hear.
> Suggested-by: Kees Cook <kees@xxxxxxxxxx>
> Link: https://zlib.net/pigz/
> Assisted-by: LLM
> Signed-off-by: Lorenzo Stoakes (ARM) <ljs@xxxxxxxxxx>
> ---
> Documentation/kbuild/kbuild.rst | 17 +++++++++++++++++
> Documentation/process/changes.rst | 8 ++++++++
> Makefile | 5 ++++-
> kernel/Makefile | 6 +++++-
> scripts/Makefile.lib | 4 ++--
Please add a line to
scripts/ver_linux
> scripts/jobserver-exec | 3 ++-
> tools/lib/python/jobserver.py | 13 +++++++++++++
> 7 files changed, 51 insertions(+), 5 deletions(-)
>
> diff --git a/Documentation/kbuild/kbuild.rst b/Documentation/kbuild/kbuild.rst
> index 5a9013bacfb7..e71a692a559a 100644
> --- a/Documentation/kbuild/kbuild.rst
> +++ b/Documentation/kbuild/kbuild.rst
> @@ -110,6 +110,23 @@ HOSTLDLIBS
> ----------
> Additional libraries to link against when building host programs.
>
> +KGZIP
> +-----
> +The gzip program used for compressed modules, packaging and the embedded
Could you also add gzip to changes.rst and ver_linux while you are at it?
Rest looks good to me.
Reviewed-by: Manuel Ebner <manuelebnerli@xxxxxxxxxxx>
Thanks
Manuel
> +kernel configuration. Defaults to gzip.
> +
> +KPGZIP
> +------
> +The gzip program used for the compressed kernel image. Defaults to pigz (a
> +parallel implementation of gzip), run under scripts/jobserver-exec so that it
> +uses the job slots make has free, if pigz is installed, otherwise to
> +``KGZIP``. Set ``KPGZIP=`` on the make command line to use another program.
> +
> +KBZIP2, KLZOP, LZMA, LZ4, XZ, ZSTD
> +----------------------------------
> +The compressor programs for the other formats. Each defaults to the program
> +of the same name.
> +
> .. _userkbuildflags:
>
> USERCFLAGS
> diff --git a/Documentation/process/changes.rst b/Documentation/process/changes.rst
> index 0aa232b117b5..28f2ca63318e 100644
> --- a/Documentation/process/changes.rst
> +++ b/Documentation/process/changes.rst
> @@ -55,6 +55,7 @@ nfs-utils 1.0.5 showmount --version
+ gzip
> openssl & libcrypto 1.0.0 openssl version
> pahole 1.26 pahole --version
> pcmciautils 004 pccardctl -V
> +pigz (optional) 2.4 pigz --version
> PPP 2.4.0 pppd --version
> procps 3.2.0 ps --version
> Python 3.9.x python3 --version
> @@ -206,6 +207,13 @@ GNU AWK
> GNU AWK is needed if you want kernel builds to generate address range data for
> builtin modules (CONFIG_BUILTIN_MODULE_RANGES).
>
> +pigz (optional)
> +---------------
> +
> +pigz is a parallel implementation of gzip. If it is installed the compressed
> +kernel image is produced with it rather than with gzip, see ``KPGZIP`` in
> +Documentation/kbuild/kbuild.rst.
> +
> System utilities
> ****************
>
> diff --git a/Makefile b/Makefile
> ...