Skip to contentSkip to conversation

Gitlab CI: Temporarily limit thread count on world builds

PATCH Superseded Tom Rini 2 participants 4 messages Oct 1 – Oct 2

lore
Share & tools
lore

Tom Rini

author
#0 lore raw

PATCH 1/1 Gitlab CI: Temporarily limit thread count on world builds

At present, our "fast" runners provided by OSU OSL have a CPU thread count limit of 28, which means that we don't run our jobs as quickly as we might expect given the number of threads that nproc sees here. On the OSU OSL side of things, they are aware and working on a set of overall improvements to everyone using the shared infrastructure. For the moment, we want to limit buildman to 28 threads when on an "osuosl" tagged runner, and whatever nproc sees on the rest.

---
 .gitlab-ci.yml | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
.gitlab-ci.yml +2 -1
index e08068f1cbf5..c5ff5341a1ef 100644
@@ -157,8 +157,9 @@ build all platforms in a single job:
         -r board/qualcomm/requirements.txt
         setuptools
     - ret=0;
+      THREADS=`echo ${CI_RUNNER_TAGS} | grep -q osuosl && echo 28 || nproc`;
       git config --global --add safe.directory "${CI_PROJECT_DIR}";
-      ./tools/buildman/buildman -o /tmp -PEWM -x xtensa || ret=$?;
+      ./tools/buildman/buildman -o /tmp -PEWM -x xtensa -T ${THREADS} || ret=$?;
       if [[ $ret -ne 0 ]]; then
         ./tools/buildman/buildman -o /tmp -seP;
         exit $ret;
Signature · 1 line
2.43.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 9 lines · Tom Rini

At present, our "fast" runners provided by OSU OSL have a CPU thread count limit of 28, which means that we don't run our jobs as quickly as we might expect given the number of threads that nproc sees here. On the OSU OSL side of things, they are aware and working on a set of overall improvements to everyone using the shared infrastructure. For the moment, we want to limit buildman to 28 threads when on an "osuosl" tagged runner, and whatever nproc sees on the rest.

Quoted 4 lines
---
 .gitlab-ci.yml | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
Quoted 19 lines
.gitlab-ci.yml +2 -2
index e08068f1cbf5..c5ff5341a1ef 100644
@@ -157,8 +157,9 @@ build all platforms in a single job:
         -r board/qualcomm/requirements.txt
         setuptools
     - ret=0;
+      THREADS=`echo ${CI_RUNNER_TAGS} | grep -q osuosl && echo 28 || nproc`;
       git config --global --add safe.directory "${CI_PROJECT_DIR}";
-      ./tools/buildman/buildman -o /tmp -PEWM -x xtensa || ret=$?;
+      ./tools/buildman/buildman -o /tmp -PEWM -x xtensa -T ${THREADS} || ret=$?;
       if [[ $ret -ne 0 ]]; then
         ./tools/buildman/buildman -o /tmp -seP;
         exit $ret;
--

2.43.0

author
#2 lore raw

PATCH v2 1/1 Gitlab CI: Temporarily limit thread count on world builds

In reply to Tom Rini

At present, our "fast" runners provided by OSU OSL have a CPU cgroups limit of 28, which means that we don't run our jobs as quickly as we might expect given the number of threads that our older version of nproc sees here. On the OSU OSL side of things, they are aware and working on a set of overall improvements to everyone using the shared infrastructure. For the moment, we want to limit what buildman fires off in this case to not essentially fork-bomb ourselves. Figure out our cgroups limit and pass -T if needed, or nothing if no limit.

Suggested-by Lance Albertson at OSU OSL

---
Changes in v2:
- Lance provided a better idea here that will also enable seamless testing of their backend changes, as they happen.

---
 .gitlab-ci.yml | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
.gitlab-ci.yml +4 -1
index e08068f1cbf5..0338f20b8a2e 100644
@@ -157,8 +157,11 @@ build all platforms in a single job:
         -r board/qualcomm/requirements.txt
         setuptools
     - ret=0;
+      if read q p < /sys/fs/cgroup/cpu.max 2>/dev/null && [ "$q" != max ]; then
+        T="-T $(( (q + p - 1) / p ))";
+      fi;
       git config --global --add safe.directory "${CI_PROJECT_DIR}";
-      ./tools/buildman/buildman -o /tmp -PEWM -x xtensa || ret=$?;
+      ./tools/buildman/buildman ${T} -o /tmp -PEWM -x xtensa || ret=$?;
       if [[ $ret -ne 0 ]]; then
         ./tools/buildman/buildman -o /tmp -seP;
         exit $ret;
Signature · 1 line
2.43.0
author
#3 lore raw
Quoted 10 lines · Tom Rini

At present, our "fast" runners provided by OSU OSL have a CPU cgroups limit of 28, which means that we don't run our jobs as quickly as we might expect given the number of threads that our older version of nproc sees here. On the OSU OSL side of things, they are aware and working on a set of overall improvements to everyone using the shared infrastructure. For the moment, we want to limit what buildman fires off in this case to not essentially fork-bomb ourselves. Figure out our cgroups limit and pass -T if needed, or nothing if no limit.

[...]

Applied to u-boot/main, thanks!

[1/1] Gitlab CI: Temporarily limit thread count on world builds

      commit: 1c0d520f7fa24b8e021c499ec13b350a8aac3eaf
Signature · 1 line
Tom