From: Prarit Bhargava <prarit(a)redhat.com>
redhat/configs/build_configs.sh: Parallelize execution
Parallelize the execution of each config building.
The '+' adds job processing to 'non-make' commands [1].
[1]
https://www.gnu.org/software/make/manual/html_node/Error-Messages.html
Signed-off-by: Prarit Bhargava <prarit(a)redhat.com>
diff --git a/redhat/Makefile b/redhat/Makefile
index blahblah..blahblah 100644
--- a/redhat/Makefile
+++ b/redhat/Makefile
@@ -148,8 +148,8 @@ dist-configs-check: dist-configs-prep
+cd $(REDHAT)/configs; ./process_configs.sh $(PROCESS_CONFIGS_CHECK_OPTS)
$(PACKAGE_NAME)
dist-configs-prep: dist-clean-configs dist-buildreq-check
- cd $(REDHAT)/configs; ./build_configs.sh "partial" "$(ARCH_MACH)"
"snip"
- cd $(REDHAT)/configs; ./build_configs.sh "$(PACKAGE_NAME)"
"$(ARCH_MACH)" "$(FLAVOR)"
+ +cd $(REDHAT)/configs; ./build_configs.sh "partial" "$(ARCH_MACH)"
"snip" "$(RHJOBS)"
+ +cd $(REDHAT)/configs; ./build_configs.sh "$(PACKAGE_NAME)"
"$(ARCH_MACH)" "$(FLAVOR)" "$(RHJOBS)"
dist-configs-arch: ARCH_MACH = $(MACH)
dist-configs-arch: dist-configs
diff --git a/redhat/configs/build_configs.sh b/redhat/configs/build_configs.sh
index blahblah..blahblah 100755
--- a/redhat/configs/build_configs.sh
+++ b/redhat/configs/build_configs.sh
@@ -16,6 +16,8 @@ else
echo "$3" > .flavors
fi
+RHJOBS="$(test -n "$4" && echo "$4" || nproc
--all)"
+
LANG=en_US.UTF-8
# to handle this script being a symlink
@@ -151,9 +153,16 @@ function build_flavor()
esac
fi
- merge_configs "$arch" "$configs" "$order"
"$flavor" "$count"
+ merge_configs "$arch" "$configs" "$order"
"$flavor" "$count" &
+ waitpids[$count]=$!
+ ((count++))
+ while [ "$(jobs | grep Running | wc -l)" -ge $RHJOBS ]; do :; done
fi
done < "$control_file"
+
+ for pid in ${waitpids[*]}; do
+ wait $pid
+ done
}
while read -r line
--
https://gitlab.com/cki-project/kernel-ark/-/merge_requests/1635