aboutsummaryrefslogtreecommitdiff
path: root/tests/nar-access.sh
diff options
context:
space:
mode:
authorAlex Wied <centromere@users.noreply.github.com>2022-07-15 00:14:29 -0400
committerAlex Wied <centromere@users.noreply.github.com>2022-07-19 16:03:58 -0400
commit1af5d798a4d10a07e995d420a759f2fe752b583a (patch)
treebc2094dbc3a575314988df9cbc011abdae6911ae /tests/nar-access.sh
parentfbd0a6c6e2e87f6679fe5cabaddaa877cf3e5a90 (diff)
libstore/globals.cc: Automatically set cores based on cgroup CPU limit
By default, Nix sets the "cores" setting to the number of CPUs which are physically present on the machine. If cgroups are used to limit the CPU and memory consumption of a large Nix build, the OOM killer may be invoked. For example, consider a GitLab CI pipeline which builds a large software package. The GitLab runner spawns a container whose CPU is limited to 4 cores and whose memory is limited to 16 GiB. If the underlying machine has 64 cores, Nix will invoke the build with -j64. In many cases, that level of parallelism will invoke the OOM killer and the build will completely fail. This change sets the default value of "cores" to be ceil(cpu_quota / cpu_period), with a fallback to std::thread::hardware_concurrency() if cgroups v2 is not detected.
Diffstat (limited to 'tests/nar-access.sh')
0 files changed, 0 insertions, 0 deletions