mirror of
https://github.com/scylladb/scylladb.git
synced 2026-05-25 09:11:10 +00:00
When building Scylla with ThinLTO enabled (default with Clang), the linker spawns threads equal to the number of CPU cores during linking. This high parallelism can cause out-of-memory (OOM) issues in CI environments, potentially freezing the build host or triggering the OOM killer. In this change: 1. Rename `LINK_MEM_PER_JOB` to `Scylla_RAM_PER_LINK_JOB` and make it user-configurable 2. Add `Scylla_PARALLEL_LINK_JOBS` option to directly control concurrent link jobs (useful for hosts with large RAM) 3. Increase the default value of `Scylla_PARALLEL_LINK_JOBS` to 16 GiB when LTO is enabled 4. Default to 2 parallel link jobs when LTO is enabled if the calculated number if less than 2 for faster build. Notes: - Host memory is shared across job pools, so pool separation alone doesn't help - Ninja lacks per-job memory quota support - Only affects link parallelism in LTO-enabled builds See https://clang.llvm.org/docs/ThinLTO.html#controlling-backend-parallelism Fixes scylladb/scylladb#22275 Signed-off-by: Kefu Chai <kefu.chai@scylladb.com> Closes scylladb/scylladb#22383