summaryrefslogtreecommitdiff
path: root/contrib/llvm-project
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2020-12-03 19:26:21 +0000
committerDimitry Andric <dim@FreeBSD.org>2020-12-03 19:26:21 +0000
commit5cc6cb2645b79b6108922957984dd86077cd7f06 (patch)
tree67673a001da0d1df60b4ac4741e3fd91eb6c46db /contrib/llvm-project
parentb957b185946ed5ad96436b50bb118db8c1a24ded (diff)
downloadsrc-test-5cc6cb2645b79b6108922957984dd86077cd7f06.tar.gz
src-test-5cc6cb2645b79b6108922957984dd86077cd7f06.zip
Revert r367815, so we can apply the slightly different version that
landed upstream: For llvm's internal function which retrieves the number of available "hardware threads", use cpuset_getaffinity(2) on FreeBSD, so it will honor processor sets configured by the cpuset(1) command. This should make it possible to avoid e.g. lld creating a huge number of threads on a machine with many cores, even for linking simple programs. This will also be submitted upstream. Submitted by: mjg
Notes
Notes: svn path=/head/; revision=368308
Diffstat (limited to 'contrib/llvm-project')
-rw-r--r--contrib/llvm-project/llvm/lib/Support/Unix/Threading.inc11
1 files changed, 0 insertions, 11 deletions
diff --git a/contrib/llvm-project/llvm/lib/Support/Unix/Threading.inc b/contrib/llvm-project/llvm/lib/Support/Unix/Threading.inc
index df290d2262eae..2d0aacabf0920 100644
--- a/contrib/llvm-project/llvm/lib/Support/Unix/Threading.inc
+++ b/contrib/llvm-project/llvm/lib/Support/Unix/Threading.inc
@@ -26,10 +26,6 @@
#include <pthread_np.h> // For pthread_getthreadid_np() / pthread_set_name_np()
#endif
-#if defined(__FreeBSD__)
-#include <sys/cpuset.h>
-#endif
-
#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
#include <errno.h>
#include <sys/sysctl.h>
@@ -286,13 +282,6 @@ SetThreadPriorityResult llvm::set_thread_priority(ThreadPriority Priority) {
#include <thread>
int computeHostNumHardwareThreads() {
-#ifdef __FreeBSD__
- cpuset_t mask;
- CPU_ZERO(&mask);
- if (cpuset_getaffinity(CPU_LEVEL_WHICH, CPU_WHICH_TID, -1, sizeof(mask),
- &mask) == 0)
- return CPU_COUNT(&mask);
-#endif
#ifdef __linux__
cpu_set_t Set;
if (sched_getaffinity(0, sizeof(Set), &Set) == 0)