build-redbear.sh: default COOKBOOK_COOK_JOBS to JOBS/2
redbear-ci / check (push) Has been cancelled

JOBS/4 left cores idle (observed load ~4.5/16 during a build). The make-job
budget division keeps total compile parallelism ~JOBS regardless of COOK_JOBS, so
RAM stays bounded; JOBS/2 keeps per-recipe make jobs >= 2 (fully using the -j
budget on busy levels) while adding enough recipe-concurrency to saturate the
cores. Higher (e.g. JOBS) would floor per-recipe jobs to 1 and waste budget.
This commit is contained in:
2026-08-02 07:51:37 +03:00
parent a2b94f8969
commit f8d3a30a23
+11 -4
View File
@@ -9,7 +9,7 @@ PROJECT_ROOT="$(cd "$SCRIPT_DIR/../.." && pwd)"
# REDBEAR_VERSION (which tracks the OS release derived from the git branch).
# Starts at 1.0 and is bumped AUTOMATICALLY on every change by the pre-commit
# git hook (local/scripts/bump-build-version.sh); do not edit the minor by hand.
BUILD_REDBEAR_VERSION="1.9"
BUILD_REDBEAR_VERSION="1.10"
# ── Colorized output ──────────────────────────────────
# Enabled only on a TTY with NO_COLOR unset, so redirected build logs and CI
@@ -303,9 +303,16 @@ CONFIG="redbear-full"
JOBS="${JOBS:-$(nproc)}"
# Dep-level parallel recipe cooking: cook this many independent (same-level)
# recipes at once. The make-job budget (JOBS) is divided across the concurrent
# cooks per level, so lone heavyweight recipes still get the full -j. Default to
# a quarter of JOBS (min 1); override with COOKBOOK_COOK_JOBS=1 to force serial.
COOK_JOBS_DEFAULT=$(( JOBS / 4 )); [ "$COOK_JOBS_DEFAULT" -lt 1 ] && COOK_JOBS_DEFAULT=1
# cooks per level, so total compile parallelism stays ~JOBS (RAM stays bounded to
# roughly a serial -j${JOBS} build) while the extra recipe-concurrency fills the
# cores left idle during configure/link/small-file phases.
#
# Default to JOBS/2: this keeps per-recipe make jobs >= 2 (so a busy level still
# uses the whole -j${JOBS} budget), while giving enough recipe-concurrency to
# saturate the machine. Going higher (e.g. JOBS/1) would floor per-recipe jobs to
# 1 and leave part of the budget unused on large levels. Override with
# COOKBOOK_COOK_JOBS=1 to force serial, or any value to tune.
COOK_JOBS_DEFAULT=$(( JOBS / 2 )); [ "$COOK_JOBS_DEFAULT" -lt 1 ] && COOK_JOBS_DEFAULT=1
export COOKBOOK_COOK_JOBS="${COOKBOOK_COOK_JOBS:-$COOK_JOBS_DEFAULT}"
APPLY_PATCHES="${APPLY_PATCHES:-1}"
NO_CACHE=0