HomePhabricator

Implement computeHostNumHardwareThreads() for FreeBSD

Authored by dim on Nov 28 2020, 12:42 PM.

Description

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

Details

Committed
dimNov 28 2020, 3:49 PM
Reviewer
MaskRay
Differential Revision
D92271: Implement computeHostNumHardwareThreads() for FreeBSD
Parents
rGf502b14d40e7: [ARMAttributeParser] Correctly parse and print Tag_THUMB_ISA_use=3
Branches
Unknown
Tags
Unknown