Skip to content

6.2.0-appliedrc9

Choose a tag to compare

@jack-zhang-ai jack-zhang-ai released this 24 Sep 17:33
· 6265 commits to master since this release
Use `Runtime#availableProcessors` on Linux

As of JDK 11, `Runtime#availableProcessors` on Linux is aware of cgroup resource limits and thus behaves as expected in containers, whereas `/proc/cpuinfo` still reports the number of logical processors available to the host.

Unfortunately, the JVM-internal `os::total_memory` function, which similarly takes cgroup limits into account when computing the available RAM, does not seem to be accessible from Java.

https://hg.openjdk.java.net/jdk/hs/rev/7f22774a5f42#l6.178

Fixes #5042

Closes #16512.

RELNOTES[INC]: Bazel's local CPU resource on Linux is now container aware. Use `--local_cpu_resources`, `--loading_phase_threads` or `--jobs` to override.

PiperOrigin-RevId: 515032721
Change-Id: I103ee25920d6908545ce6bf03d9c42c604c8589b