Blame SOURCES/0055-Run-xz-and-lzma-with-multiple-threads.patch

18971c
From 90441c4476481e4e05edacf44903aeac2feecd6d Mon Sep 17 00:00:00 2001
18971c
From: Vratislav Podzimek <vpodzime@redhat.com>
18971c
Date: Wed, 13 Nov 2013 13:20:39 +0100
18971c
Subject: [PATCH] Run 'xz' and 'lzma' with multiple threads
18971c
18971c
This speeds up compression a lot on multicore systems.
18971c
18971c
https://bugzilla.redhat.com/show_bug.cgi?id=1029786
18971c
18971c
[Edited-by: Harald Hoyer: use getconf for cpu_count]
18971c
---
18971c
 dracut.sh | 6 ++++--
18971c
 1 file changed, 4 insertions(+), 2 deletions(-)
18971c
18971c
diff --git a/dracut.sh b/dracut.sh
18971c
index b03522bf..59d3e4b2 100755
18971c
--- a/dracut.sh
18971c
+++ b/dracut.sh
18971c
@@ -693,12 +693,14 @@ stdloglvl=$((stdloglvl + verbosity_mod_l))
18971c
 # eliminate IFS hackery when messing with fw_dir
18971c
 fw_dir=${fw_dir//:/ }
18971c
 
18971c
+cpu_count=$(getconf _NPROCESSORS_ONLN)
18971c
+
18971c
 # handle compression options.
18971c
 [[ $compress ]] || compress="gzip"
18971c
 case $compress in
18971c
     bzip2) compress="bzip2 -9";;
18971c
-    lzma)  compress="lzma -9";;
18971c
-    xz)    compress="xz --check=crc32 --lzma2=dict=1MiB";;
18971c
+    lzma)  compress="lzma -9 ${cpu_count:+-T$cpu_count}";;
18971c
+    xz)    compress="xz --check=crc32 --lzma2=dict=1MiB ${cpu_count:+-T$cpu_count}";;
18971c
     gzip)  compress="gzip -9"; command -v pigz > /dev/null 2>&1 && compress="pigz -9";;
18971c
     lzo)   compress="lzop -9";;
18971c
     lz4)   compress="lz4 -9";;