From: Prarit Bhargava <prarit(a)redhat.com>
redhat/kernel.spec.template: Parallelize compression
This line in the kernel.spec file:
find $RPM_BUILD_ROOT/lib/modules/ -type f -name '*.ko' | xargs
-P${RPM_BUILD_NCPUS} -r xz;
implies that ${RPM_BUILD_NCPUS} xz instances are run. This is not true,
and this line actually applies ${RPM_BUILD_NCPUS} to a single instance of
xz. This means that the compression has been done one module at a time
(ie, in serial) rather than in parallel as is implied by the code.
Use xarg's -n option to assign one cpu per process and parallelize the
compression.
Suggested-by: "Herton R. Krzesinski" <herton(a)redhat.com>
Signed-off-by: Prarit Bhargava <prarit(a)redhat.com>
diff --git a/redhat/kernel.spec.template b/redhat/kernel.spec.template
index blahblah..blahblah 100755
--- a/redhat/kernel.spec.template
+++ b/redhat/kernel.spec.template
@@ -2472,7 +2472,8 @@ find Documentation -type d | xargs chmod u+w
fi \
fi \
if [ "%{zipmodules}" -eq "1" ]; then \
- find $RPM_BUILD_ROOT/lib/modules/ -type f -name '*.ko' | xargs
-P${RPM_BUILD_NCPUS} -r xz; \
+ echo "Compressing kernel modules ..." \
+ find $RPM_BUILD_ROOT/lib/modules/ -type f -name '*.ko' | xargs -n 1
-P${RPM_BUILD_NCPUS} -r xz; \
fi \
%{nil}
--
https://gitlab.com/cki-project/kernel-ark/-/merge_requests/2254