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

(cherry picked from commit c3f7be36e8ad24c31a3c56851681803704a4b0b2)

Details

Provenance
dimAuthored on Dec 3 2020, 7:29 PM
Parents
rG39e8b505feb0: Revert r367815, so we can apply the slightly different version that
Branches
Unknown
Tags
Unknown