Re: [PATCH v1 1/2] kbuild: Mark the kernel image gzip recipes as recursive

From: Nicolas Schier

Date: Fri Oct 09 2026 - 05:08:38 EST


> Since commit 48ebe1cbbeb51 ("kbuild: compress the kernel with pigz if
> available"), cmd_gzip runs pigz through scripts/jobserver-exec, which
> takes the job slots make has free. GNU Make passes the jobserver pipe
> only to recipes it treats as recursive, but leaves --jobserver-auth in
> MAKEFLAGS for all of them. The make 4.3 in CentOS Stream 9 also hides
> the pipe in sub-makes (a backport of the fix for GNU Make bug 58232), so
> jobserver-exec cannot open it, runs pigz on one thread, and prints:
>
> WARNING: Unable to reopen jobserver read-side pipe: FileNotFoundError(2, 'No such file or directory')
>
> Mark the gzip recipes as recursive with "+", as commit ecab4115c44cc
> ("kbuild: mark `rustc` (and others) invocations as recursive") did for
> rustc. As with those, "make -n" now runs them.
>
> Tested ARCH=x86_64 and ARCH=arm64 defconfig with GNU Make 4.3 plus
> CentOS Stream 9's make-4.3-cloexec.patch, GCC 16.2.0, and -j64: without
> this change the warning appears and pigz runs with "-p 1"; with it there
> is no warning, and pigz runs with "-p 54" and "-p 64".
>
> Reported-by: Paul E. McKenney <paulmck@xxxxxxxxxx>
> Closes: https://lore.kernel.org/all/0ddb5e5e-f801-444c-aa98-0cfe814a3026@paulmck-laptop/
> Fixes: 48ebe1cbbeb51 ("kbuild: compress the kernel with pigz if available")
> Assisted-by: LLM
> Signed-off-by: Kees Cook <kees@xxxxxxxxxx>
> ---
> arch/alpha/boot/Makefile | 4 ++--
> arch/arc/boot/Makefile | 2 +-
> arch/arm64/boot/Makefile | 2 +-
> arch/microblaze/boot/Makefile | 2 +-
> arch/mips/boot/Makefile | 2 +-
> arch/nios2/boot/Makefile | 2 +-
> arch/parisc/boot/compressed/Makefile | 2 +-
> arch/riscv/boot/Makefile | 2 +-
> arch/s390/boot/Makefile | 2 +-
> arch/sh/boot/Makefile | 2 +-
> arch/sh/boot/compressed/Makefile | 2 +-
> arch/sparc/boot/Makefile | 4 ++--
> arch/x86/boot/compressed/Makefile | 2 +-
> arch/xtensa/boot/Makefile | 2 +-
> 14 files changed, 16 insertions(+), 16 deletions(-)

Reviewed-by: Nicolas Schier <n.schier@xxxxxxxxx>


Before it gets lost, we should also update the documentation bit that
references $(if_changed,gzip):

diff --git a/Documentation/kbuild/makefiles.rst b/Documentation/kbuild/makefiles.rst
index 7521cae7d56f..2760717ab7b7 100644
--- a/Documentation/kbuild/makefiles.rst
+++ b/Documentation/kbuild/makefiles.rst
@@ -1452,13 +1452,14 @@ objcopy
OBJCOPYFLAGS_$@ may be used to set additional options.

gzip
- Compress target. Use maximum compression to compress target.
+ Compress target. Use maximum compression to compress target. Add '+' prefix
+ to allow parallel gzip compression via pigz (if available).

Example::

#arch/x86/boot/compressed/Makefile
$(obj)/vmlinux.bin.gz: $(vmlinux.bin.all-y) FORCE
- $(call if_changed,gzip)
+ +$(call if_changed,gzip)

dtc
Create flattened device tree blob object suitable for linking


--
Nicolas