File 0001-Compress-kernel-modules-in-batch-and-in-parallel.patch of Package pesign-obs-integration.20743
From d64b3f6f8d82e6006c9290aecedd412789eda6f9 Mon Sep 17 00:00:00 2001
From: Dirk Mueller <dirk@dmllr.de>
Date: Thu, 15 Oct 2020 23:06:12 +0200
Subject: [PATCH] Compress kernel modules in batch and in parallel
currently we're sequentially compressing the modules using
xz -9. In testing against the kernel 5.8 in Tumbleweed, there
was very little compression size difference between xz -9 and xz,
however almost a 40% runtime performance improvement.
Also running in 4 jobs in parallel (instead of using xz -threads)
improves speed quite a bit. Last but not least wrapping
the invocations via "xargs -t" ensures that there is a constant
stream of logging output that prevents the build service
from killing the job as it is considered stalled.
Signed-off-by: Dirk Mueller <dirk@dmllr.de>
---
pesign-gen-repackage-spec | 16 +++++++++++++---
1 file changed, 13 insertions(+), 3 deletions(-)
diff --git a/pesign-gen-repackage-spec b/pesign-gen-repackage-spec
index 037da59..22a1c47 100755
--- a/pesign-gen-repackage-spec
+++ b/pesign-gen-repackage-spec
@@ -391,6 +391,7 @@ my %verifyflags = (
sub print_files {
my $files = shift;
+ my @tocompress;
for my $f (@$files) {
my $path = "$directory/$f->{name}";
@@ -445,9 +446,9 @@ sub print_files {
if ($compress eq "xz" &&
$f->{name} =~ /\.ko$/ && S_ISREG($f->{mode})) {
- system("xz", "-f", "-9", $path);
- chmod($f->{mode}, $path . ".xz");
- utime($f->{mtime}, $f->{mtime}, $path . ".xz");
+ chmod($f->{mode}, $path);
+ utime($f->{mtime}, $f->{mtime}, $path);
+ push(@tocompress, $path);
print SPEC "$attrs " . quote($f->{name}) . ".xz\n";
} else {
print SPEC "$attrs " . quote($f->{name}) . "\n";
@@ -457,6 +458,15 @@ sub print_files {
print SPEC "$attrs " . quote($f->{name}) . ".sig\n";
}
}
+
+ if ($#tocompress >= 0) {
+ my $m = "$output/modulelist.txt";
+ open(M, '>', $m) or die "$m: $!\n";
+ print M join("\n", @tocompress);
+ close(M);
+ system("xargs -a $m -t -P 4 -n 1 xz -f");
+ unlink($m);
+ }
}
my %packages;
--
2.32.0