HomeFreeBSD

Merge commit d989ffd10 from llvm git (by Dimitry Andric):

Description

Merge commit d989ffd10 from llvm git (by Dimitry Andric):

Implement computeHostNumHardwareThreads() for FreeBSD

This retrieves CPU affinity via FreeBSD's cpuset(2) API, and makes
LLVM respect affinity settings configured by the user via the
cpuset(1) command.

In particular, this allows to reduce the number of threads used on
machines with high core counts, which can interact badly with
parallelized build systems. This is particularly noticable with lld,
which spawns lots of threads even for linking e.g. hello_world!

This fix is related to PR48193, but does not adress the more
fundamental problem, which is that LLVM by default grabs as many CPUs
and/or threads as possible.

Reviewed By: MaskRay

Differential Revision: https://reviews.llvm.org/D92271

Originally by: mjg
MFC after: 1 week

Details

Provenance
dimAuthored on
Parents
rS368308: Revert r367815, so we can apply the slightly different version that
Branches
Unknown
Tags
Unknown