[all-commits] [llvm/llvm-project] d989ff: Implement computeHostNumHardwareThreads() for FreeBSD

Dimitry Andric via All-commits all-commits at lists.llvm.org
Sat Nov 28 15:50:07 PST 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: d989ffd109b2b5e7fd7c577ea549f4d1c5f5492c
      https://github.com/llvm/llvm-project/commit/d989ffd109b2b5e7fd7c577ea549f4d1c5f5492c
  Author: Dimitry Andric <dimitry at andric.com>
  Date:   2020-11-29 (Sun, 29 Nov 2020)

  Changed paths:
    M llvm/lib/Support/Unix/Threading.inc

  Log Message:
  -----------
  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




More information about the All-commits mailing list