I would like to suggest to change how the value for smp_mflags is computed. Currently it is the number of cpus online and 16 is the max. I suggest to include the memory size into the calculation, because with for example C++ code the compiler can easily require 2GB per process. So if the builder machine doesn't have adequate memory it starts swapping and later the compiler (or linker) gets killed by the kernel OOM killer. my proposal smp_mflags = MIN( getconf _NPROCESSORS_ONLN , RAMSIZE / TASKSIZE) and use eg. TASKSIZE=2GB The real case where OOM is in action during builds is on ppc64 builders with 48 (shared virtual) CPUs and 10GB of memory (+ some swap) and building ceph. I think it can also help on ARM with 4 CPUs and only 4GB of memory when they start swapping easily.
This package has changed ownership in the Fedora Package Database. Reassigning to the new owner of this component.
%_smp_mflags lives in rpm now, switching component (wow this is an old one...) It'd need some tunables (tasksize at least) and maybe 32/64bit-ness should be taken into account for the heuristics too.
Ack, tunable "tasksize" makes sense.
FWIW, there's a work-in-progress PR at upstream where further input (+ testing) is welcome: https://github.com/rpm-software-management/rpm/pull/821
We've been hit by this recently in RHEL again with Thunderbird. The builder hard 8 CPUs, but just 14 GB of available RAM. We will start to use what was suggested by Dan in comment 0 for Thunderbird and Firefox: # Free memory in kB MEM_AVAILABLE=$(grep MemAvailable /proc/meminfo | awk '{ print $2 }') # Usually the compiler processes can take 2 GB of memory at peaks TASK_SIZE=2000000 MEM_CONSTRAINED_JOBS=$(( MEM_AVAILABLE / TASK_SIZE )) CPU_AVAILABLE=$(/usr/bin/getconf _NPROCESSORS_ONLN) # Pick the minimum from available CPUs or memory constrained number of jobs MOZ_SMP_FLAGS=$([ "$CPU_AVAILABLE" -le "$MEM_CONSTRAINED_JOBS" ] && echo "$CPU_AVAILABLE" || echo "$MEM_CONSTRAINED_JOBS")
This is (finally) implemented in rpm 4.19.